当前位置: 首页>>代码示例>>Python>>正文


Python User.update方法代码示例

本文整理汇总了Python中model.user.User.update方法的典型用法代码示例。如果您正苦于以下问题:Python User.update方法的具体用法?Python User.update怎么用?Python User.update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.user.User的用法示例。


在下文中一共展示了User.update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle_facebook_login

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import update [as 别名]
 def handle_facebook_login(self):
     access_token = self.request.get('access_token')
     user_id = self.request.get('user_id')
     profile_url = 'https://graph.facebook.com/me?access_token=%s'
     profile = json.loads(urlfetch.fetch(profile_url%access_token).content)
     logging.info('Facebook Login:: ')
     logging.info(profile)
     id = profile['id']
     if not id == user_id:
         response = {"success": False, "error": "Facebook ids don't match."}
     else:
         if 'email' in profile:
             email = profile['email']
         else:
             email = id
         user = User.get_by_key_name(email)
         device_token = self.request.get('token_hex')
         if not user:
             user = User.create(email, profile['first_name'], profile['last_name'], device_token)
             ThirdPartyUser.create('FB', user, access_token, id)
             profile_picture = self.get_profile_picture(id)
             User.update(email, profile_picture=profile_picture, device_token=device_token)
         else:
             User.update(email, device_token=device_token)
         util.set_session(email)
         response = {"success": True, "email": email, "first_name": user.first_name, "last_name": user.last_name}
     return response
开发者ID:mschwalb,项目名称:photobout,代码行数:29,代码来源:users.py

示例2: post

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import update [as 别名]
 def post(self):
     session = get_current_session()
     email = session['me_email']
     name = self['name']
     password = self['password']
     photos = self.get_uploads("uploaded_photo")
     photo = self['image']
     if photos:
         photo_blob_key = photos[0].key()
         photo = '/api/common/download_image/'+str(photo_blob_key)
     User.update(email=email,name=name,password=password,photo=photo)
     self.redirect('/member/profile')
开发者ID:aiyappaganesh,项目名称:underdogs,代码行数:14,代码来源:users.py

示例3: handle_custom_login

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import update [as 别名]
 def handle_custom_login(self):
     email = self.request.get('email')
     password = self.request.get('password')
     logging.info('Custom Login:: ')
     logging.info(email)
     user = User.get_by_key_name(email)
     if user and ThirdPartyUser.for_user(user).count() > 0:
         response = {"success": False, "error": "You have previously logged in with Facebook. Please log in using Facebook."}
         return response
     device_token = self.request.get('token_hex')
     if user and self.check_password(email, password):
         User.update(email, device_token=device_token)
         util.set_session(email)
         response = {"success": True, "email": email, "first_name": user.first_name, "last_name": user.last_name}
     else:
         response = {"success": False, "error": "The email or password you entered is incorrect."}
     return response
开发者ID:mschwalb,项目名称:photobout,代码行数:19,代码来源:users.py

示例4: post

# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import update [as 别名]
 def post(self):
     user = util.get_user_from_session()
     first_name = self.request.get('first_name')
     last_name = self.request.get('last_name')
     User.update(user.email, first_name=first_name, last_name=last_name)
开发者ID:mschwalb,项目名称:photobout,代码行数:7,代码来源:users.py


注:本文中的model.user.User.update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。