예제 #1
0
    def get_url_decorator(self, pattern):
        "Fixes bug in Application.get_url_decorator which would decorate None values."
        permissions = self.get_permissions(pattern.name)
        if permissions is not None:
            return permissions_required(permissions)

        return None
예제 #2
0
    def get_url_decorator(self, pattern):
        "Fixes bug in Application.get_url_decorator wich would decorate None values."
        permissions = self.get_permissions(pattern.name)
        if permissions is not None:
            return permissions_required(permissions)

        return None
    def get_url_decorator(self, pattern):
        """
        Return the appropriate decorator for the view function with the passed
        URL name. Mainly used for access-protecting views.
        It's possible to specify
        - no permissions necessary: use None
        - a set of permissions: use a list
        - two set of permissions (`or`): use a two-tuple of lists

        See permissions_required decorator for details
        """
        permissions = self.get_permissions(pattern.name)
        return permissions_required(permissions)
예제 #4
0
    def get_url_decorator(self, pattern):
        """
        Return the appropriate decorator for the view function with the passed
        URL name. Mainly used for access-protecting views.

        It's possible to specify:

        - no permissions necessary: use None
        - a set of permissions: use a list
        - two set of permissions (`or`): use a two-tuple of lists

        See permissions_required decorator for details
        """
        permissions = self.get_permissions(pattern.name)
        return permissions_required(permissions)
예제 #5
0
    def get_url_decorator(self, pattern):
        """
        Return the appropriate decorator for the view function with the passed
        URL name. Mainly used for access-protecting views.

        It's possible to specify:

        - no permissions necessary: use None
        - a set of permissions: use a list
        - two set of permissions (`or`): use a two-tuple of lists

        See permissions_required decorator for details

        使用传递的URL名称返回视图函数的相应装饰器。 主要用于访问保护视图。
        可以指定:
        - 无需权限:使用None
        - 一组权限:使用列表
        - 两组权限(`或`):使用两元组列表
        有关详细信息,请参见permission_required装饰器
        """
        permissions = self.get_permissions(pattern.name)
        if permissions:
            return permissions_required(permissions, login_url=self.login_url)