本文整理汇总了Python中models.UserData.put方法的典型用法代码示例。如果您正苦于以下问题:Python UserData.put方法的具体用法?Python UserData.put怎么用?Python UserData.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.UserData
的用法示例。
在下文中一共展示了UserData.put方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import UserData [as 别名]
# 或者: from models.UserData import put [as 别名]
def get(self):
user = users.get_current_user()
day_time = datetime.today() - timedelta(1)
query = UserData.gql("WHERE user = :1", user)
thisUser = query.get()
if thisUser is None:
thisUser = UserData(user=user, lastemail=day_time, Number_Tiles=0)
thisUser.put()
N_tiles = 0
else:
N_tiles = thisUser.Number_Tiles
self.response.write(N_tiles)
示例2: get_data
# 需要导入模块: from models import UserData [as 别名]
# 或者: from models.UserData import put [as 别名]
def get_data(self, uid):
data = UserData.get_by_id(uid)
if data:
changed = 0
if not data.separator:
data.separator = defaults['separator']
changed += 1
if not data.date_repr:
data.date_repr = defaults['date_repr']
changed += 1
if not data.time_repr:
data.time_repr = defaults['time_repr']
changed += 1
if not data.new_day_time:
data.new_day_time = defaults['new_day_time']
changed += 1
if type(data.new_day_time) == tuple:
data.new_day_time = defaults['new_day_time']
if not data.time_span:
data.time_span = defaults['time_span']
changed += 1
if not data.time_zone:
data.time_zone = defaults['time_zone']
changed += 1
if not data.log:
data.log = defaults['log']
changed += 1
if changed:
data.put()
else:
data = UserData(
id=uid,
separator = defaults['separator'],
date_repr = defaults['date_repr'],
time_repr = defaults['time_repr'],
new_day_time = defaults['new_day_time'],
time_span = defaults['time_span'],
time_zone = defaults['time_zone'],
log = defaults['log'])
data.put()
return data