本文整理汇总了Python中api.models.User.active方法的典型用法代码示例。如果您正苦于以下问题:Python User.active方法的具体用法?Python User.active怎么用?Python User.active使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类api.models.User
的用法示例。
在下文中一共展示了User.active方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: authorized
# 需要导入模块: from api.models import User [as 别名]
# 或者: from api.models.User import active [as 别名]
def authorized():
resp = google.authorized_response()
if resp is None:
return 'Access denied: reason=%s error=%s' % (
request.args['error_reason'],
request.args['error_description']
)
session['google_token'] = (resp['access_token'], '')
me = google.get('userinfo')
#app.config['userdata'] = me.data
user = User.query(User.email == me.data['email']).fetch()
if not user:
user = User()
user.name = me.data['name']
user.email = me.data['email']
user.thumbnail = me.data['picture']
user.active = True
user.authenticated = True
user.anonymous = True
user.active = True
user.put()
session['user_id'] = me.data['email']
session['_fresh'] = True
flash('Logged in successfully.')
return redirect(urlservice)
示例2: create_user
# 需要导入模块: from api.models import User [as 别名]
# 或者: from api.models.User import active [as 别名]
def create_user(self, author, user, passhash, user_root):
u = User()
u.author = author
u.user_root = user_root
u.active = True
u.name = user
u.password = passhash
u.save()