本文整理汇总了Python中framework.auth.Auth.is_login方法的典型用法代码示例。如果您正苦于以下问题:Python Auth.is_login方法的具体用法?Python Auth.is_login怎么用?Python Auth.is_login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类framework.auth.Auth
的用法示例。
在下文中一共展示了Auth.is_login方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listado
# 需要导入模块: from framework.auth import Auth [as 别名]
# 或者: from framework.auth.Auth import is_login [as 别名]
def listado():
_auth = Auth()
if _auth.is_login():
data = {}
user = db.GqlQuery("SELECT * FROM User WHERE username = :1", _auth.is_login()).fetch(1)[0]
data['series'] = Serie.all().filter("user=",user)
return template("series/listado.html", data)
else:
return template("sin-permisos.html")
示例2: login
# 需要导入模块: from framework.auth import Auth [as 别名]
# 或者: from framework.auth.Auth import is_login [as 别名]
def login():
"""
Iniciar Session
"""
_auth = Auth()
if not _auth.is_login():
return template('auth/login.html')
else:
message = "Error ya has iniciado Session con la cuenta \"%s\" " %_auth.is_login()
message += "en caso de querer proceder por fabor cierra la session actual."
return template("message.html", {'message': message} )
示例3: do_registrar
# 需要导入模块: from framework.auth import Auth [as 别名]
# 或者: from framework.auth.Auth import is_login [as 别名]
def do_registrar():
_auth = Auth()
if _auth.is_login():
#field validation
_name = request.forms.get('name')
_day = request.forms.get('day')
_url = request.forms.get('url')
_chapter_url = request.forms.get('chapter_url')
_num_chapters = request.forms.get('mun_chapters')
_old_chapter = request.forms.get('old_chapter')
#el usuario existe se supone que esta logueado sino cagada jaaj
_user = db.GqlQuery("SELECT * FROM User WHERE username = :1", _auth.is_login()).fetch(1)[0]
if _num_chapters <= _old_chapter:
_old_chapter = _num_chapters
_enabled = False
else:
_enabled = True
serie = Serie(
user = _user,
name = _name,
day = _day,
url = _url,
chapter_url = _chapter_url,
num_chapters = int(_num_chapters),
old_chapter = int(_old_chapter), #ultimo capitulo que salio
enabled = _enabled
)
serie.put()
# Registro los capitulos
n = int(_old_chapter) + 1
for num in range(1, n):
chapter = Chapter(
serie = serie,
number = num,
url = serie.chapter_url %num,
show = False
)
chapter.put()
return "Serie Registrada"
#return template("series/registrar.html")
else:
return template("sin-permisos.html")
示例4: do_registrar
# 需要导入模块: from framework.auth import Auth [as 别名]
# 或者: from framework.auth.Auth import is_login [as 别名]
def do_registrar():
"""
"""
_auth = Auth()
if not _auth.is_login:
errors = [] #errores
#validacion de campos vacios
_username = request.forms.get('username')
if _username == "":
errors.append("El campo Usuario esta vacio")
#validacion de contrasenias
_password = request.forms.get('password')
repassword = request.forms.get('repassword')
if len(_password) < 8 or len(_password) >= 16:
errors.append("la contrasenia debe tener entre 8 y 16 caracteres")
if _password != repassword:
errors.append("Las contrasenias no coinciden")
_name = request.forms.get('name')
if _name == "":
errors.append("El campo Nombre esta vacio")
_email = request.forms.get('email')
if _email == "":
errors.append("El campo Email esta vacio")
if len(errors) == 0:
#validacion de que no exista el usuario
query = db.GqlQuery("SELECT * FROM User WHERE username = :1", _username)
if query.count() != 0:
errors.append("El nombre de usuarios \"%s\" ya existe" %_username)
form_error = True
else:
user = User(
username = _username,
password = _password,
name = _name,
email = _email,
)
user.put()
return template("auth/registrar-ok.html")
else:
form_error = True
#si llego hasta aqui hay algun tipo de errors
data = {
"errors" : errors,
"form_error": form_error,
"username": _username,
"name": _name,
"email": _email,
}
return template("auth/registrar.html", data)
else:
message = "Error ya has iniciado Session con la cuenta \"%s\" " %_auth.is_login()
message += "en caso de querer proceder por fabor cierra la session actual."
return template("message.html", {'message': message} )
示例5: index
# 需要导入模块: from framework.auth import Auth [as 别名]
# 或者: from framework.auth.Auth import is_login [as 别名]
def index():
#pagina de inicio
_auth = Auth()
if (_auth.is_login()):
is_login = True
else:
is_login = False
return template('home.html', {'is_login':is_login })
示例6: registrar
# 需要导入模块: from framework.auth import Auth [as 别名]
# 或者: from framework.auth.Auth import is_login [as 别名]
def registrar():
_auth = Auth()
if _auth.is_login():
return template("series/registrar.html")
else:
return template("sin-permisos.html")
示例7: debug
# 需要导入模块: from framework.auth import Auth [as 别名]
# 或者: from framework.auth.Auth import is_login [as 别名]
def debug():
"""
Vista Para Pruebas
"""
a = Auth()
return str(a.is_login()),'-', str(a.is_admin())