当前位置: 首页>>代码示例>>Python>>正文


Python Account.get_by_id方法代码示例

本文整理汇总了Python中models.account.Account.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Account.get_by_id方法的具体用法?Python Account.get_by_id怎么用?Python Account.get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.account.Account的用法示例。


在下文中一共展示了Account.get_by_id方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import get_by_id [as 别名]
    def post(self, user_id):
        self._require_admin()
        user = Account.get_by_id(user_id)

        user.display_name = self.request.get("display_name")
        user.put()

        self.redirect("/admin/user/" + user_id)
开发者ID:BowlesCR,项目名称:the-blue-alliance,代码行数:10,代码来源:admin_user_controller.py

示例2: get

# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import get_by_id [as 别名]
    def get(self, user_id):
        self._require_admin()
        user = Account.get_by_id(user_id)
        self.template_values.update({
            "user": user
        })

        path = os.path.join(os.path.dirname(__file__), '../../templates/admin/user_edit.html')
        self.response.out.write(template.render(path, self.template_values))
开发者ID:BowlesCR,项目名称:the-blue-alliance,代码行数:11,代码来源:admin_user_controller.py

示例3: post

# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import get_by_id [as 别名]
    def post(self, user_id):
        self._require_admin()
        user = Account.get_by_id(user_id)

        user.display_name = self.request.get("display_name")
        user.permissions = []
        for enum in AccountPermissions.permissions:
            permcheck = self.request.get("perm-" + str(enum))
            if permcheck :
                user.permissions.append(enum)
        user.put()

        self.redirect("/admin/user/" + user_id)
开发者ID:samuelcouch,项目名称:the-blue-alliance,代码行数:15,代码来源:admin_user_controller.py

示例4: post

# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import get_by_id [as 别名]
    def post(self):
        self._require_registration()

        # Check to make sure that they aren't trying to edit another user
        real_account_id = self.user_bundle.account.key.id()
        check_account_id = self.request.get('account_id')
        if check_account_id == real_account_id:
            user = Account.get_by_id(self.user_bundle.account.key.id())
            user.display_name = self.request.get('display_name')
            user.put()
            self.redirect('/account?status=account_edit_success')
        else:
            self.redirect('/account?status=account_edit_failure')
开发者ID:CarlColglazier,项目名称:the-blue-alliance,代码行数:15,代码来源:account_controller.py

示例5: post

# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import get_by_id [as 别名]
    def post(self):
        self._require_login('/account/edit')
        self._require_registration('/account/register')

        # Check to make sure that they aren't trying to edit another user
        real_account_id = self.user_bundle.account.key.id()
        check_account_id = self.request.get('account_id')
        if check_account_id == real_account_id:
            user = Account.get_by_id(self.user_bundle.account.key.id())
            user.display_name = self.request.get('display_name')
            user.put()
            self.redirect('/account')
        else:
            self.redirect('/')
开发者ID:BowlesCR,项目名称:the-blue-alliance,代码行数:16,代码来源:account_controller.py

示例6: get

# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import get_by_id [as 别名]
    def get(self):
        self._require_admin()

        if tba_config.CONFIG["env"] != "prod":
            account = Account.get_by_id(self.user_bundle.account.key.id())
            account.display_name = "Test User"
            account.registered = True
            account.permissions = AccountPermissions.permissions.keys()
            account.put()

            self.redirect("/admin/user/" + account.key.id())
        else:
            logging.error("{} tried to set up a test user in prod! No can do.".format(
                self.user_bundle.user.email()))
            self.redirect("/admin/")
开发者ID:brycematsuda,项目名称:the-blue-alliance,代码行数:17,代码来源:admin_user_controller.py

示例7: post

# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import get_by_id [as 别名]
    def post(self):
        self._require_login('/account/register')
        if self.user_bundle.account.registered:
            self.redirect('/account')
            return None

        # Check to make sure that they aren't trying to edit another user
        real_account_id = self.user_bundle.account.key.id()
        check_account_id = self.request.get('account_id')
        if check_account_id == real_account_id:
            account = Account.get_by_id(self.user_bundle.account.key.id())
            account.display_name = self.request.get('display_name')
            account.registered = True
            account.put()
            self.redirect('/account')
        else:
            self.redirect('/')
开发者ID:chrismarra,项目名称:the-blue-alliance,代码行数:19,代码来源:account_controller.py

示例8: user_email_to_id

# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import get_by_id [as 别名]
    def user_email_to_id(cls, user_email):
        '''
        Returns the user id for a given email address (or None if invalid)
        workaround for this bug: https://code.google.com/p/googleappengine/issues/detail?id=8848
        solution from: http://stackoverflow.com/questions/816372/how-can-i-determine-a-user-id-based-on-an-email-address-in-app-engine
        '''
        u = users.User(user_email)
        key = MobileUser(user=u).put()
        obj = key.get()
        user_id = obj.user.user_id()
        key.delete()

        if Account.get_by_id(user_id) is None:
            # Create an account for this user
            Account(id=user_id, email = user_email, nickname = user_email.split('@')[0], registered = False).put()

        return user_id
开发者ID:dewdn2,项目名称:the-blue-alliance,代码行数:19,代码来源:push_helper.py

示例9: post

# 需要导入模块: from models.account import Account [as 别名]
# 或者: from models.account.Account import get_by_id [as 别名]
    def post(self):
        self._require_login()
        if self.user_bundle.account.registered:
            self.redirect("/account", abort=True)

        # Check to make sure that they aren't trying to edit another user
        real_account_id = self.user_bundle.account.key.id()
        check_account_id = self.request.get("account_id")
        if check_account_id == real_account_id:
            account = Account.get_by_id(self.user_bundle.account.key.id())
            account.display_name = self.request.get("display_name")
            account.registered = True
            account.put()

            redirect = self.request.get("redirect")
            if redirect:
                self.redirect(redirect, abort=True)
            else:
                self.redirect("/account", abort=True)
        else:
            self.redirect("/")
开发者ID:the-blue-alliance,项目名称:the-blue-alliance,代码行数:23,代码来源:account_controller.py


注:本文中的models.account.Account.get_by_id方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。