本文整理汇总了Python中models.Box.put方法的典型用法代码示例。如果您正苦于以下问题:Python Box.put方法的具体用法?Python Box.put怎么用?Python Box.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Box
的用法示例。
在下文中一共展示了Box.put方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: process_request
# 需要导入模块: from models import Box [as 别名]
# 或者: from models.Box import put [as 别名]
def process_request(self, request):
""" This function sets up the user object
Depending on the value of require_login, it
can return None as 'profile'.
"""
#Get Google user_id
google_user = users.get_current_user()
account = None
is_admin = False
logging.info(request.META['HTTP_USER_AGENT'])
if google_user:
#Check if the user already has a site profile
user_id = google_user.user_id()
is_admin = users.is_current_user_admin()
q = Account.all()
q.filter('google_user =', google_user)
account = q.get()
if not account:
nickname = hashlib.md5(google_user.nickname()).hexdigest()[:10]
account = Account(user_id = user_id, nickname = nickname)
account.put()
box = Box(title='My Box')
box.put()
request.user = account
Account.current_user_account = account
request.user_is_admin = is_admin