當前位置: 首頁>>代碼示例>>Python>>正文


Python UserProfile.createKey方法代碼示例

本文整理匯總了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
開發者ID:rogerthat-platform,項目名稱:rogerthat-backend,代碼行數:36,代碼來源:unsubscribe_reminder_service.py

示例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
開發者ID:our-city-app,項目名稱:mobicage-backend,代碼行數:12,代碼來源:friend_helper.py

示例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)
開發者ID:our-city-app,項目名稱:mobicage-backend,代碼行數:12,代碼來源:update_friends.py

示例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))
開發者ID:rogerthat-platform,項目名稱:rogerthat-backend,代碼行數:51,代碼來源:unsubscribe_reminder_service.py


注:本文中的rogerthat.models.UserProfile.createKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。