示例#1
0
    def generate_choices(entries):
        results = []

        for namespace, permissions in itertools.groupby(
                entries, lambda entry: entry.namespace):
            permission_options = [(force_text(permission.pk), permission)
                                  for permission in permissions]
            results.append(
                (PermissionNamespace.get(namespace), permission_options))

        return results
示例#2
0
文件: views.py 项目: e6/mayan-edms
    def generate_choices(entries):
        results = []

        for namespace, permissions in itertools.groupby(entries, lambda entry: entry.namespace):
            permission_options = [
                (unicode(permission.pk), permission) for permission in permissions
            ]
            results.append(
                (PermissionNamespace.get(namespace), permission_options)
            )

        return results
示例#3
0
    def generate_choices(entries):
        results = []

        entries = sorted(entries,
                         key=lambda x:
                         (x.get_volatile_permission().namespace.label,
                          x.get_volatile_permission().label))

        for namespace, permissions in itertools.groupby(
                entries, lambda entry: entry.namespace):
            permission_options = [(force_text(permission.pk), permission)
                                  for permission in permissions]
            results.append(
                (PermissionNamespace.get(namespace), permission_options))

        return results
示例#4
0
    def generate_choices(entries):
        results = []

        entries = sorted(
            entries, key=lambda x: (
                x.get_volatile_permission().namespace.label,
                x.get_volatile_permission().label
            )
        )

        for namespace, permissions in itertools.groupby(entries, lambda entry: entry.namespace):
            permission_options = [
                (force_text(permission.pk), permission) for permission in permissions
            ]
            results.append(
                (PermissionNamespace.get(namespace), permission_options)
            )

        return results