本文整理汇总了Python中rogerthat.models.UserProfile.createKey方法的典型用法代码示例。如果您正苦于以下问题:Python UserProfile.createKey方法的具体用法?Python UserProfile.createKey怎么用?Python UserProfile.createKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rogerthat.models.UserProfile
的用法示例。
在下文中一共展示了UserProfile.createKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _un_subscribe
# 需要导入模块: from rogerthat.models import UserProfile [as 别名]
# 或者: from rogerthat.models.UserProfile import createKey [as 别名]
def _un_subscribe(self, app_user, si_user, broadcast_type):
user_profile, si, fsic = db.get([UserProfile.createKey(app_user),
ServiceIdentity.keyFromUser(add_slash_default(si_user)),
FriendServiceIdentityConnection.createKey(app_user, si_user)])
logging.info('%s is unsubscribing from notifications of "%s" with type "%s".',
user_profile.name if user_profile else app_user.email(),
si.name if si else si_user.email(),
broadcast_type)
updated = False
if fsic:
if broadcast_type in fsic.enabled_broadcast_types:
fsic.enabled_broadcast_types.remove(broadcast_type)
updated = True
if broadcast_type not in fsic.disabled_broadcast_types:
fsic.disabled_broadcast_types.append(broadcast_type)
updated = True
if updated:
fsic.put()
models = db.get([UserData.createKey(fsic.friend, fsic.service_identity_user)] +
[get_mobile_key_by_account(mobile.account) for mobile in user_profile.mobiles])
user_data_model, mobiles = models[0], models[1:]
create_send_user_data_requests(mobiles, user_data_model, fsic, fsic.friend, fsic.service_identity_user)
schedule_update_a_friend_of_a_service_identity_user(fsic.service_identity_user, fsic.friend, force=True,
clear_broadcast_settings_cache=True)
else:
logging.info('%s was already unsubscribed from notifications of "%s" with type "%s".',
user_profile.name if user_profile else app_user.email(),
si.name if si else si_user.email(),
broadcast_type)
return updated, user_profile, si, fsic
示例2: _ensure_data
# 需要导入模块: from rogerthat.models import UserProfile [as 别名]
# 或者: from rogerthat.models.UserProfile import createKey [as 别名]
def _ensure_data(self):
if self.has_data:
return
else:
if self.is_service:
self._service_profile = get_service_profile(self.service_user)
self._profile_info = get_service_identity(self.service_identity_user)
else:
self._profile_info = db.get(UserProfile.createKey(self.user))
self.has_data = True
示例3: trans
# 需要导入模块: from rogerthat.models import UserProfile [as 别名]
# 或者: from rogerthat.models.UserProfile import createKey [as 别名]
def trans(user):
helper = FriendHelper.serialize(user, friend_type)
if friend_type == FRIEND_TYPE_SERVICE:
user = remove_slash_default(user)
else:
update_friend_service_identity_connections(UserProfile.createKey(user), changed_properties)
run_job(get_friends_friends_maps_keys_query, [user], _update_friend, [helper, clear_broadcast_settings_cache],
worker_queue=worker_queue)
示例4: get
# 需要导入模块: from rogerthat.models import UserProfile [as 别名]
# 或者: from rogerthat.models.UserProfile import createKey [as 别名]
def get(self):
data_dict, app_user = self.get_user_info()
if not data_dict or not app_user:
return
azzert(data_dict['a'] == "unsubscribe deactivate")
app, user_profile = db.get([App.create_key(get_app_id_from_app_user(app_user)),
UserProfile.createKey(app_user)])
if not user_profile:
self.redirect("/")
return
mobiles = list(get_user_active_mobiles(app_user))
if mobiles:
mobile = mobiles[0]
if mobile.type in Mobile.ANDROID_TYPES:
page_type = "android"
elif mobile.type in Mobile.IOS_TYPES:
page_type = "ios"
else:
return self.return_error()
else:
mobile = None
page_type = "web"
page_type = self.request.get("page_type", page_type)
language = self.request.get("language", user_profile.language)
ActivationLog(timestamp=now(), email=app_user.email(), mobile=mobile,
description="Visit unsubscribe page %s %s" % (page_type, user_profile.language)).put()
jinja_template = self.get_jinja_environment().get_template('unsubscribe_deactivate.html')
params = {
'name': data_dict['n'],
'app_name': get_app_by_user(app_user).name,
'hide_header': True,
'data': self.request.get("data"),
'app_email': app_user.email(),
'email': get_human_user_from_app_user(app_user).email(),
'action': data_dict['a'],
'page_type': page_type,
'language': language,
'is_city_app': app.type == App.APP_TYPE_CITY_APP
}
self.response.out.write(jinja_template.render(params))