本文整理汇总了Python中rogerthat.models.UserProfile.get_birth_day_int方法的典型用法代码示例。如果您正苦于以下问题:Python UserProfile.get_birth_day_int方法的具体用法?Python UserProfile.get_birth_day_int怎么用?Python UserProfile.get_birth_day_int使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rogerthat.models.UserProfile
的用法示例。
在下文中一共展示了UserProfile.get_birth_day_int方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: trans
# 需要导入模块: from rogerthat.models import UserProfile [as 别名]
# 或者: from rogerthat.models.UserProfile import get_birth_day_int [as 别名]
def trans(image):
changed_properties = []
user_profile = get_user_profile(app_user)
if name is not MISSING:
if user_profile.name != name:
changed_properties.append(u"name")
user_profile.name = name
# has_birthdate and has_gender are used starting from 1.0.999.A and 1.0.137.i
if has_birthdate is not MISSING and has_gender is not MISSING:
if has_birthdate is True:
user_profile.birthdate = birthdate
user_profile.birth_day = UserProfile.get_birth_day_int(birthdate)
if has_gender is True:
user_profile.gender = gender
else:
# birthdate and gender are only used without has_gender and has_birthdate in 1.0.998.A
if birthdate is not MISSING and gender is not MISSING:
if birthdate == 0 and gender == 0:
pass # user pressed save in 1.0.998.A without setting gender and birthdate
else:
user_profile.birthdate = birthdate
user_profile.birth_day = UserProfile.get_birth_day_int(birthdate)
if gender != 0:
user_profile.gender = gender
if image:
avatar = get_avatar_by_id(user_profile.avatarId)
if not avatar:
avatar = Avatar(user=user_profile.user)
image = base64.b64decode(str(image))
img = Image(image)
if img.width > 150 or img.height > 150:
logging.info('Resizing avatar from %sx%s to 150x150', img.width, img.height)
img.resize(150, 150)
image = img.execute_transforms(img.format, 100)
update_avatar_profile(user_profile, avatar, image)
changed_properties.append(u"avatar")
user_profile.version += 1
user_profile.put()
from rogerthat.bizz.profile import update_mobiles, update_friends
update_mobiles(user_profile.user, user_profile, current_mobile) # update myIdentity
schedule_re_index(app_user)
if changed_properties: # Not necessary when only birth date or gender were updated.
update_friends(user_profile) # notify my friends.