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


Python Agreement.find方法代码示例

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


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

示例1: get_stats_for_signed_agreements

# 需要导入模块: from indico.modules.events.agreements.models.agreements import Agreement [as 别名]
# 或者: from indico.modules.events.agreements.models.agreements.Agreement import find [as 别名]
    def get_stats_for_signed_agreements(cls, event):
        """Returns a digest of signed agreements on an event

        :param event: the event
        :return: (everybody_signed, num_accepted, num_rejected)
        """
        people = cls.get_people(event)
        identifiers = [p.identifier for p in people.itervalues()]
        query = Agreement.find(Agreement.event_id == event.getId(),
                               Agreement.type == cls.name,
                               Agreement.identifier.in_(identifiers))
        num_accepted = query.filter(Agreement.accepted).count()
        num_rejected = query.filter(Agreement.rejected).count()
        everybody_signed = len(people) == (num_accepted + num_rejected)
        return everybody_signed, num_accepted, num_rejected
开发者ID:NIIF,项目名称:indico,代码行数:17,代码来源:base.py

示例2: export_agreements

# 需要导入模块: from indico.modules.events.agreements.models.agreements import Agreement [as 别名]
# 或者: from indico.modules.events.agreements.models.agreements.Agreement import find [as 别名]
 def export_agreements(self, aw):
     sent_agreements = {a.identifier: a for a in Agreement.find(event_id=self._event.getId(),
                                                                type=self._definition.name)}
     for person in islice(sorted(self._definition.get_people(self._event).itervalues(),
                                 key=attrgetter('name', 'identifier')),
                          self._offset, self._offset + self._limit):
         agreement = sent_agreements.get(person.identifier)
         data = {
             'event_id': int(self._event.id),
             'identifier': person.identifier,
             'sent': agreement is not None,
             'accepted': None if (not agreement or agreement.pending) else agreement.accepted,
         }
         self._definition.extend_api_data(self._event, person, agreement, data)
         yield data
开发者ID:dbourillot,项目名称:indico,代码行数:17,代码来源:api.py

示例3: _merge_users

# 需要导入模块: from indico.modules.events.agreements.models.agreements import Agreement [as 别名]
# 或者: from indico.modules.events.agreements.models.agreements.Agreement import find [as 别名]
def _merge_users(target, source, **kwargs):
    Agreement.find(user_id=source.id).update({Agreement.user_id: target.id})
开发者ID:MichelCordeiro,项目名称:indico,代码行数:4,代码来源:__init__.py

示例4: get_people_not_notified

# 需要导入模块: from indico.modules.events.agreements.models.agreements import Agreement [as 别名]
# 或者: from indico.modules.events.agreements.models.agreements.Agreement import find [as 别名]
 def get_people_not_notified(cls, event):
     """Returns a dictionary of :class:`AgreementPersonInfo` yet to be notified"""
     people = cls.get_people(event)
     sent_agreements = {a.identifier for a in Agreement.find(event_id=event.getId(), type=cls.name)}
     return {k: v for k, v in people.items() if v.identifier not in sent_agreements}
开发者ID:NIIF,项目名称:indico,代码行数:7,代码来源:base.py

示例5: _merge_users

# 需要导入模块: from indico.modules.events.agreements.models.agreements import Agreement [as 别名]
# 或者: from indico.modules.events.agreements.models.agreements.Agreement import find [as 别名]
def _merge_users(user, merged, **kwargs):
    new_id = int(user.id)
    old_id = int(merged.id)
    Agreement.find(user_id=old_id).update({'user_id': new_id})
开发者ID:marcosmolla,项目名称:indico,代码行数:6,代码来源:__init__.py


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