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


Python groups.LocalGroup类代码示例

本文整理汇总了Python中indico.modules.groups.models.groups.LocalGroup的典型用法代码示例。如果您正苦于以下问题:Python LocalGroup类的具体用法?Python LocalGroup怎么用?Python LocalGroup使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: _create_group

 def _create_group(id_):
     group = LocalGroup()
     group.id = id_
     group.name = u'dummy-{}'.format(id_)
     db.session.add(group)
     db.session.flush()
     return group.proxy
开发者ID:MichelCordeiro,项目名称:indico,代码行数:7,代码来源:user.py

示例2: migrate_groups

    def migrate_groups(self):
        print cformat('%{white!}migrating groups')

        for old_group in committing_iterator(self.zodb_root['groups'].itervalues()):
            if old_group.__class__.__name__ != 'Group':
                continue
            group = LocalGroup(id=int(old_group.id), name=convert_to_unicode(old_group.name).strip())
            print cformat('%{green}+++%{reset} %{white!}{:6d}%{reset} %{cyan}{}%{reset}').format(group.id, group.name)
            members = set()
            for old_member in old_group.members:
                if old_member.__class__.__name__ != 'Avatar':
                    print cformat('%{yellow!}!!!        Unsupported group member type: {}').format(
                        old_member.__class__.__name__)
                    continue
                user = User.get(int(old_member.id))
                if user is None:
                    print cformat('%{yellow!}!!!        User not found: {}').format(old_member.id)
                    continue
                while user.merged_into_user:
                    user = user.merged_into_user
                if user.is_deleted:
                    print cformat('%{yellow!}!!!        User deleted: {}').format(user.id)
                    continue
                members.add(user)
            for member in sorted(members, key=attrgetter('full_name')):
                print cformat('%{blue!}<->%{reset}        %{white!}{:6d} %{yellow}{} ({})').format(
                    member.id, member.full_name, member.email)
            group.members = members
            db.session.add(group)
开发者ID:MichelCordeiro,项目名称:indico,代码行数:29,代码来源:groups.py

示例3: search

    def search(cls, name, exact=False, providers=None):
        """Searches for groups

        :param name: The group name to search for.
        :param exact: If only exact matches should be found (much faster)
        :param providers: ``None`` to search in all providers and
                          local groups. May be a set specifying
                          providers to search in. For local groups, the
                          ``'indico'`` provider name may be used.
        """
        name = name.strip()
        if not name:
            return []
        if exact:
            criterion = db.func.lower(LocalGroup.name) == name.lower()
        else:
            criterion = db.func.lower(LocalGroup.name).contains(name.lower())
        result = set()
        if providers is None or "indico" in providers:
            result |= {g.proxy for g in LocalGroup.find(criterion)}
        result |= {
            GroupProxy(g.name, g.provider.name, _group=g)
            for g in multipass.search_groups(name, providers=providers, exact=exact)
        }
        return sorted(result, key=lambda x: x.name.lower())
开发者ID:k3njiy,项目名称:indico,代码行数:25,代码来源:core.py

示例4: _checkParams

 def _checkParams(self):
     if "group_id" in request.view_args:
         self.new_group = False
         self.group = LocalGroup.get(request.view_args["group_id"])
         if self.group is None:
             raise NotFound
     else:
         self.new_group = True
         self.group = LocalGroup()
开发者ID:OmeGak,项目名称:indico,代码行数:9,代码来源:controllers.py

示例5: _process_args

 def _process_args(self):
     if 'group_id' in request.view_args:
         self.new_group = False
         self.group = LocalGroup.get(request.view_args['group_id'])
         if self.group is None:
             raise NotFound
     else:
         self.new_group = True
         self.group = LocalGroup()
开发者ID:jas01,项目名称:indico,代码行数:9,代码来源:controllers.py

示例6: validate_name

 def validate_name(self, field):
     query = LocalGroup.find(db.func.lower(LocalGroup.name) == field.data.lower())
     if self.group:
         query = query.filter(LocalGroup.id != self.group.id)
     if query.count():
         raise ValidationError(_('A group with this name already exists.'))
开发者ID:MichelCordeiro,项目名称:indico,代码行数:6,代码来源:forms.py

示例7: group

 def group(self):
     """The underlying :class:`.LocalGroup`"""
     return LocalGroup.get(self.id)
开发者ID:marcosmolla,项目名称:indico,代码行数:3,代码来源:core.py

示例8: has_data

 def has_data(self):
     return bool(LocalGroup.find().count())
开发者ID:MichelCordeiro,项目名称:indico,代码行数:2,代码来源:groups.py


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