def redirigir(self,*args,**kw):
		sess = Sesion()
		if sess.load():
			validosecre=GraboSecretaria()			
			if validosecre.ExisteSecretaria(sess.getUser()):
				return func(self, *args, **kw)
			else:
				Mensaje("No tiene los permisos necesarios")
Example #2
0
class Logout(webapp.RequestHandler):
       	def get(self):
		MyPath=AbsolutePath()
		path=MyPath.getAbsolutePath()
		pathtemplate=None
		self.session=Sesion()
                self.session.logout()
                self.redirect("/")
	def redirigir(self,*args,**kw):
		sess = Sesion()
		if sess.load():
			validodr=ValidoDoctor()
			if validodr.ExisteDr(sess.getUser()):
				return func(self, *args, **kw)
			else:
				Mensaje("No tiene los permisos necesarios")
Example #4
0
 def get(self):
     MyPath=AbsolutePath()
     path=MyPath.getAbsolutePath()
     pathtemplate = os.path.join(path, 'templates/verEstudios.html')
     sess = Sesion()
     diagnostico=Diagnosticos()
     template_values ={                                
                         'dr':diagnostico.EsDoctor(sess.getUser())
                     }
     self.response.out.write(template.render(pathtemplate, template_values))
class FinalizarPago (webapp.RequestHandler):
	def get(self,req):
                MyPath=AbsolutePath()
		ABSpath=MyPath.getAbsolutePath()
##                try:
                paypal = PayPal()
                token=self.request.get('token')
                PayerID=self.request.get('PayerID')
                #obtengo la cantidad del cookie
                cookie=SesionPayment()
                cantidad=cookie.load()
                if int(cantidad)>0:
                        respuesta=paypal.DoExpressCheckoutPayment(token,PayerID,cantidad)
                        if self.find_key(respuesta,"ACK"):
                                if respuesta["ACK"]=='Success':
                                        self.session=Sesion()
                                        self.session.store(token,3600,'armedPS')#la sesion dura una hora en la cookie armedPS
                                        path = os.path.join(ABSpath, 'templates/finalizarpago.html')	
                                        self.response.out.write(template.render(path, None))
                                else:
                                        path = os.path.join(ABSpath, 'templates/cancelar.html')
                                        template_values={
                                                        'mensaje': 'La operación fue cancelada por PayPal',
                                                }
                                        self.response.out.write(template.render(path, template_values))
                        else:
                                path = os.path.join(ABSpath, 'templates/cancelar.html')
                                template_values={
                                                'mensaje': 'La operación fue cancelada, Respuesta incorrecta por parte de PayPal',
                                        }
                                self.response.out.write(template.render(path, template_values))
                else:
                        path = os.path.join(ABSpath, 'templates/cancelar.html')
                        template_values={
                                'mensaje': 'La operación fue cancelada, Error en los cookies',
                        }
                        self.response.out.write(template.render(path, template_values))
##                except:
##                                path = os.path.join(ABSpath, 'templates/cancelar.html')
##                                template_values={
##                                                'mensaje': 'Ocurrio un error.<br> La operaci&oacute;n fue cancelada.',
##                                        }
##                                self.response.out.write(template.render(path, template_values))


        def find_key(self,dic, val):
            """Devuelve verdadero si existe la llave en el diccionario"""
            bRetorno=False
            for k in dic.iteritems():
                if k[0] == val:
                        bRetorno=True
                        break
            return bRetorno
Example #6
0
       	def get(self):
		MyPath=AbsolutePath()
		path=MyPath.getAbsolutePath()
		pathtemplate=None
		self.session=Sesion()
                self.session.logout()
                self.redirect("/")
Example #7
0
        def get(self):
		"""ABC de Citas"""
		MyPath=AbsolutePath()
		path=MyPath.getAbsolutePath()

		pathtemplate = os.path.join(path, 'templates/citas.html')
		fecha=str(dt.date.today().day)+"/"+str(dt.date.today().month)+"/"+str(dt.date.today().year)[2:]
		fechaVer2=str(dt.date.today().day)+"-"+str(dt.date.today().month)+"-"+str(dt.date.today().year)
		sess = Sesion()
		doctores=self.ObtenerDoctores(sess.getUser())
		template_values={
                                'horarios':self.Agenda(doctores[0].usuario.usuario,fecha),#self.horario(),
				'doctores':doctores,
                                'hoy':fechaVer2,
				#'citas':self.Citas(doctores[0].usuario.usuario,fecha),								
                        }
		self.response.out.write(template.render(pathtemplate, template_values))
Example #8
0
	def get(self):
		"""ABC de altas de doctores"""
		MyPath=AbsolutePath()
		path=MyPath.getAbsolutePath()
		pathtemplate = os.path.join(path, 'templates/datosdr.html')
		
		template_values =None
		session=Sesion()
		dr=ValidoDoctor()
		if dr.ExisteDr(session.getUser()):
			template_values = {
				'FormaDoctor' :FormaDoctor(instance=dr.instanciaDoctor(session.getUser())),
				
			}
		else:
			template_values = {
				'FormaDoctor' :FormaDoctor(),				
			}
		self.response.out.write(template.render(pathtemplate, template_values))
	def get(self):
		"""ABC de altas de doctores"""
		MyPath=AbsolutePath()
		path=MyPath.getAbsolutePath()
		pathtemplate = os.path.join(path, 'templates/datospaciente.html')
		
		session=Sesion()
		paciente=GraboPaciente()
		cita=Citas() #para obtener la lista de dr relacionados con el usuario
		doctores=cita.ObtenerDoctores(session.getUser())
		
		if paciente.ExistePaciente(session.getUser()):
			template_values = {
			'FormaPaciente' :FormaPaciente(instance=paciente.instanciaPaciente(session.getUser())),
			'existe': False,
			'doctores':doctores,
			}
		else:
			template_values = {
				'FormaPaciente' :FormaPaciente(),
				'existe': True,
				'doctores':doctores,
			}
		self.response.out.write(template.render(pathtemplate, template_values))
	def get(self,req):
                MyPath=AbsolutePath()
		ABSpath=MyPath.getAbsolutePath()
##                try:
                paypal = PayPal()
                token=self.request.get('token')
                PayerID=self.request.get('PayerID')
                #obtengo la cantidad del cookie
                cookie=SesionPayment()
                cantidad=cookie.load()
                if int(cantidad)>0:
                        respuesta=paypal.DoExpressCheckoutPayment(token,PayerID,cantidad)
                        if self.find_key(respuesta,"ACK"):
                                if respuesta["ACK"]=='Success':
                                        self.session=Sesion()
                                        self.session.store(token,3600,'armedPS')#la sesion dura una hora en la cookie armedPS
                                        path = os.path.join(ABSpath, 'templates/finalizarpago.html')	
                                        self.response.out.write(template.render(path, None))
                                else:
                                        path = os.path.join(ABSpath, 'templates/cancelar.html')
                                        template_values={
                                                        'mensaje': 'La operaci&oacute;n fue cancelada por PayPal',
                                                }
                                        self.response.out.write(template.render(path, template_values))
                        else:
                                path = os.path.join(ABSpath, 'templates/cancelar.html')
                                template_values={
                                                'mensaje': 'La operaci&oacute;n fue cancelada, Respuesta incorrecta por parte de PayPal',
                                        }
                                self.response.out.write(template.render(path, template_values))
                else:
                        path = os.path.join(ABSpath, 'templates/cancelar.html')
                        template_values={
                                'mensaje': 'La operaci&oacute;n fue cancelada, Error en los cookies',
                        }
                        self.response.out.write(template.render(path, template_values))
        def redirigir(self,*args, **kw):                
        	sess = Sesion()
        	if sess.load():
                        return func(self, *args, **kw)
                else:
			Mensaje("Login requerido")
Example #12
0
from flask import Flask,request

from usuarios import Usuarios
from sesion import Sesion 
from bitacora import bitacora
app = Flask("usuario")

usuario = Usuarios()
sesion = Sesion()
bita = bitacora()

@app.route('/crear_usuario',methods=['POST'])
def crear_usuariol():
	print "crear usuario"
	usu = str(request.form['usuario'])
	passwd = str(request.form['password'])
	ret =sesion.crear(usu,passwd)
	print "hola-"+ret
	bita.cargar(ret)
	return ret

@app.route('/login',methods=['POST'])
def login():
	usu = str(request.form['usuario'])
	passwd = str(request.form['password'])
	ret= sesion.login(usu,passwd)
	bita.cargar(ret)
	return ret


@app.route('/listad',methods=['POST'])
Example #13
0
        path 	           = '/meneame/story.php?id='+str(d['url'])
        action             = d['action']
        self.lastOperation = action
        self.lastPage      = d['url']
        html = ''
        if action == 'No':
            try:
        	   self._connection.request("GET", path)
        	   html = self._connection.getresponse()
            except httplib.BadStatusLine:
                pass
            except Exception, e: #Servidor Saturado
                self._print("Unexpected error:" + str(e))
        else:# Es un comentario o una noticia
            try:
            	s = Sesion('cajainas', 'miquel1234')

            	if action == 'Comentario':
            		s.make_a_comment(d['url']) #noticia 2858
            	else:
            		s.make_a_new('www.meneame.net/story.php?id='+str(d['url']))
            except Exception, e: #Servidor Saturado
                self._print("Mechanize error:" + str(e))
        endTime = time() - timeStart
        #self.responseTime = endTime + self.responseTime
        self.responseTime = endTime
        #self._print("Salgo de request")
        return html

    def _close_connection(self):
        """