本文整理匯總了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