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


Python UserProfile.all方法代碼示例

本文整理匯總了Python中rogerthat.models.UserProfile.all方法的典型用法代碼示例。如果您正苦於以下問題:Python UserProfile.all方法的具體用法?Python UserProfile.all怎麽用?Python UserProfile.all使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rogerthat.models.UserProfile的用法示例。


在下文中一共展示了UserProfile.all方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: delete_app

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def delete_app(app_id):
    app = get_app(app_id)
    validate_can_delete_app(app)
    to_delete = [
        AppSettings.create_key(app_id),
        app.key()
    ]
    to_put = []
    for profile_key in UserProfile.all(keys_only=True).filter('app_id', app_id):
        delete_account(users.User(profile_key.parent().name()))
    for other_app in App.all():
        if app_id in other_app.orderable_app_ids:
            other_app.orderable_app_ids.remove(app_id)
            to_put.append(other_app)
    db.delete(to_delete)
    if to_put:
        put_and_invalidate_cache(to_put)
開發者ID:rogerthat-platform,項目名稱:rogerthat-backend,代碼行數:19,代碼來源:app.py

示例2: _delete_ownership_users

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def _delete_ownership_users(service_email):
    to_put = []
    for up in UserProfile.all().filter("owningServiceEmails =", service_email):
        if service_email in up.owningServiceEmails:
            up.owningServiceEmails.remove(service_email)
        if list(get_user_active_mobiles(up.user)):
            if not up.owningServiceEmails:
                up.isCreatedForService = False
            to_put.append(up)
        else:
            if not up.owningServiceEmails:
                deferred.defer(delete_account, up.user, _countdown=5)
            else:
                to_put.append(up)

    if to_put:
        put_and_invalidate_cache(*to_put)
開發者ID:rogerthat-platform,項目名稱:rogerthat-backend,代碼行數:19,代碼來源:delete_service.py

示例3: send_overview_email

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def send_overview_email(from_, to, dry_run=True, skipped_users=None):
    if skipped_users is None:
        skipped_users = set()
    server_settings = get_server_settings()
    key = '%s-%s' % (from_, to)
    dsp = DSPickler.read(key)
    users = sorted(set(dsp.data[0]) - skipped_users)
    body = u"\n".join(users) or u"No reminders sent"
    body = "COUNT: %s (%.02f%%)\nDRY_RUN: %s\n\n%s" % (len(users),
                                                       100.0 * len(users) / UserProfile.all().count(None),
                                                       dry_run,
                                                       body)
    msg = MIMEMultipart('alternative')
    msg['Subject'] = "Rogerthat reminders sent"
    msg['From'] = server_settings.senderEmail
    msg['To'] = ', '.join(server_settings.supportWorkers)
    msg.attach(MIMEText(body.encode('utf-8'), 'plain', 'utf-8'))
    send_mail_via_mime(server_settings.dashboardEmail, server_settings.supportWorkers, msg)
    deferred.defer(cleanup, key)
開發者ID:gitter-badger,項目名稱:rogerthat-backend,代碼行數:21,代碼來源:send_unread_messages.py

示例4: post

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
    def post(self):
        app_id = self.request.POST.get("app_id", None)

        self.response.headers['Content-Type'] = 'text/json'
        if not app_id:
            self.response.out.write(json.dumps(dict(success=False, errormsg=u"Failed to delete app (app_id was empty)!")))
        else:
            app = get_app_by_id(app_id)
            if app:
                if len(UserProfile.all().filter('app_id =', app_id).fetch(1)) > 0:
                    self.response.out.write(json.dumps(dict(success=False, errormsg=u"Failed to remove app (has users)")))
                else:
                    if len(ServiceIdentity.all().filter('app_ids =', app_id).fetch(1)) > 0:
                        self.response.out.write(json.dumps(dict(success=False, errormsg=u"Failed to remove app (service_identies contain app)")))
                    else:
                        app.delete()
                        self.response.out.write(json.dumps(dict(success=True, errormsg=u"Successfully removed app!")))
            else:
                self.response.out.write(json.dumps(dict(success=False, errormsg=u"Could not delete unknown app")))
開發者ID:gitter-badger,項目名稱:rogerthat-backend,代碼行數:21,代碼來源:apps.py

示例5: get_service_grants

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def get_service_grants(service_user, filtered_service_identity=ServiceIdentity.DEFAULT, filtered_role_id=None,
                       filtered_role_type=None):
    from rogerthat.bizz.roles import ROLE_TYPE_ADMIN, ROLE_TYPE_SERVICE
    service_user_email = service_user.email()
    if not isinstance(service_user_email, unicode):
        service_user_email = service_user_email.decode('utf-8')

    profiles = UserProfile.all().filter('role_services >=', service_user_email + '/').filter('role_services <', service_user_email + u'/\ufffd')
    for p in profiles:
        for si, roles in p.grants.iteritems():
            if si.startswith(service_user_email + '/'):
                _, identity = get_service_identity_tuple(users.User(si))
                if filtered_service_identity != ServiceIdentity.DEFAULT and identity != filtered_service_identity:
                    continue
                for role in roles:
                    gto = GrantTO()
                    if role.startswith('sr:'):
                        gto.role_type = ROLE_TYPE_SERVICE
                        gto.role = None
                        gto.role_id = int(role[3:])
                    else:
                        gto.role_type = ROLE_TYPE_ADMIN
                        gto.role = role
                        gto.role_id = -1

                    if filtered_role_id is not None and filtered_role_id != gto.role_id:
                        continue
                    if filtered_role_type is not None and filtered_role_type != gto.role_type:
                        continue

                    gto.identity = identity
                    gto.service_email = service_user_email
                    gto.user_email = get_human_user_from_app_user(p.user).email()
                    gto.user_name = p.name
                    gto.user_avatar_id = p.avatarId
                    gto.app_id = p.app_id
                    yield gto
開發者ID:gitter-badger,項目名稱:rogerthat-backend,代碼行數:39,代碼來源:roles.py

示例6: get_user_profiles_by_app_id

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def get_user_profiles_by_app_id(app_id):
    return UserProfile.all().filter('app_id =', app_id)
開發者ID:rogerthat-platform,項目名稱:rogerthat-backend,代碼行數:4,代碼來源:profile.py

示例7: get_user_profile_keys_by_app_id

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def get_user_profile_keys_by_app_id(app_id):
    return UserProfile.all(keys_only=True).filter('app_id =', app_id)
開發者ID:rogerthat-platform,項目名稱:rogerthat-backend,代碼行數:4,代碼來源:profile.py

示例8: cleanup_sessions

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def cleanup_sessions(service_user):
    for user_profile_key in UserProfile.all(keys_only=True).filter('owningServiceEmails', service_user.email()):
        drop_sessions_of_user(users.User(user_profile_key.name()))
    drop_sessions_of_user(service_user)
    send_message(service_user, 'rogerthat.system.logout')
開發者ID:gitter-badger,項目名稱:rogerthat-backend,代碼行數:7,代碼來源:profile.py

示例9: query

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def query():
    return UserProfile.all(keys_only=True)
開發者ID:rogerthat-platform,項目名稱:rogerthat-backend,代碼行數:4,代碼來源:re_index_app_users.py

示例10: _get_app_users

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def _get_app_users(app_id):
    return UserProfile.all().filter('app_id', app_id)
開發者ID:our-city-app,項目名稱:mobicage-backend,代碼行數:4,代碼來源:app_broadcast.py

示例11: _get_profile_keys

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def _get_profile_keys(app_id):
    return UserProfile.all(keys_only=True).filter('app_id', app_id)
開發者ID:rogerthat-platform,項目名稱:rogerthat-backend,代碼行數:4,代碼來源:update_app_asset.py

示例12: user_profiles

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def user_profiles():
    return UserProfile.all()
開發者ID:rogerthat-platform,項目名稱:rogerthat-backend,代碼行數:4,代碼來源:user_index.py

示例13: _get_all_users

# 需要導入模塊: from rogerthat.models import UserProfile [as 別名]
# 或者: from rogerthat.models.UserProfile import all [as 別名]
def _get_all_users():
    return UserProfile.all(keys_only=True)
開發者ID:our-city-app,項目名稱:mobicage-backend,代碼行數:4,代碼來源:migrate_service_roles.py


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