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


Python agreements.Agreement类代码示例

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


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

示例1: test_reject

def test_reject(reason, on_behalf, expected_state):
    ip = '127.0.0.1'
    agreement = Agreement()
    agreement.reject(from_ip=ip, reason=reason, on_behalf=on_behalf)
    assert agreement.state == expected_state
    assert agreement.signed_from_ip == ip
    assert agreement.reason == reason
    assert agreement.signed_dt == now_utc()
    agreement.definition.handle_rejected.assert_called_with(agreement)
开发者ID:k3njiy,项目名称:indico,代码行数:9,代码来源:agreements_test.py

示例2: test_reset

def test_reset():
    agreement = Agreement()
    agreement.reset()
    assert agreement.state == AgreementState.pending
    assert agreement.attachment is None
    assert agreement.attachment_filename is None
    assert agreement.data is None
    assert agreement.reason is None
    assert agreement.signed_dt is None
    assert agreement.signed_from_ip is None
开发者ID:k3njiy,项目名称:indico,代码行数:10,代码来源:agreements_test.py

示例3: _process

 def _process(self):
     event = self._conf
     people = self.definition.get_people(event)
     agreements = Agreement.find_all(Agreement.event_id == event.getId(),
                                     Agreement.type == self.definition.name,
                                     Agreement.identifier.in_(people))
     return WPAgreementManager.render_template('agreement_type_details.html', event,
                                               event=event, definition=self.definition, agreements=agreements)
开发者ID:,项目名称:,代码行数:8,代码来源:

示例4: test_create_from_data

def test_create_from_data(dummy_event, dummy_person, dummy_user, person_with_user):
    type_ = 'dummy'
    dummy_person.user = dummy_user if person_with_user else None
    agreement = Agreement.create_from_data(event=dummy_event, type_=type_, person=dummy_person)
    assert agreement.event == dummy_event
    assert agreement.type == type_
    assert agreement.state == AgreementState.pending
    assert agreement.uuid
    assert agreement.identifier == dummy_person.identifier
    assert agreement.person_email == dummy_person.email
    assert agreement.person_name == dummy_person.name
    assert agreement.user == dummy_person.user
    assert agreement.data == dummy_person.data
开发者ID:k3njiy,项目名称:indico,代码行数:13,代码来源:agreements_test.py

示例5: export_agreements

 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,代码行数:15,代码来源:api.py

示例6: _process_args

 def _process_args(self):
     RHAgreementManagerDetails._process_args(self)
     if 'id' in request.view_args:
         self.agreement = Agreement.get_one(request.view_args['id'])
         if self.event != self.agreement.event:
             raise NotFound
         if not self.agreement.pending:
             raise NoReportError(_("The agreement is already signed"))
     else:
         self.agreement = None
         identifier = request.args['identifier']
         try:
             self.person = self.definition.get_people(self.event)[identifier]
         except KeyError:
             raise NotFound
开发者ID:indico,项目名称:indico,代码行数:15,代码来源:controllers.py

示例7: get_stats_for_signed_agreements

    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,代码行数:15,代码来源:base.py

示例8: _checkParams

 def _checkParams(self, params):
     RHAgreementManagerDetails._checkParams(self, params)
     if 'id' in request.view_args:
         self.agreement = Agreement.find_one(id=request.view_args['id'])
         if self._conf != self.agreement.event:
             raise NotFound
         if not self.agreement.pending:
             raise NoReportError(_("The agreement is already signed"))
     else:
         self.agreement = None
         identifier = request.args['identifier']
         try:
             self.person = self.definition.get_people(self._conf)[identifier]
         except KeyError:
             raise NotFound
开发者ID:,项目名称:,代码行数:15,代码来源:

示例9: send_new_agreements

def send_new_agreements(event, name, people, email_body, cc_addresses, from_address):
    """Creates and send agreements for a list of people on a given event.

    :param event: The `Event` associated with the agreement
    :param name: The agreement type matcing a :class:`AgreementDefinition` name
    :param people: The list of people for whom agreements will be created
    :param email_body: The body of the email
    :param cc_addresses: Email addresses to send CCs to
    :param from_address: Email address of the sender
    """
    agreements = []
    for person in people.itervalues():
        agreement = Agreement.create_from_data(event=event, type_=name, person=person)
        db.session.add(agreement)
        agreements.append(agreement)
    db.session.flush()
    for agreement in agreements:
        notify_agreement_new(agreement, email_body, cc_addresses, from_address)
    return agreements
开发者ID:DirkHoffmann,项目名称:indico,代码行数:19,代码来源:util.py

示例10: _get_agreements

 def _get_agreements(self):
     ids = set(request.form.getlist('references'))
     return Agreement.find_all(Agreement.id.in_(ids), Agreement.person_email != None)
开发者ID:,项目名称:,代码行数:3,代码来源:

示例11: test_is_orphan_no_definition

def test_is_orphan_no_definition(monkeypatch):
    monkeypatch.setattr(Agreement, 'definition', property(lambda s: None))
    agreement = Agreement()
    with pytest.raises(ServiceUnavailable):
        agreement.is_orphan()
开发者ID:DirkHoffmann,项目名称:indico,代码行数:5,代码来源:agreements_test.py

示例12: test_belongs_to

def test_belongs_to():
    agreement = Agreement(identifier='foo')
    assert agreement.belongs_to(MagicMock(identifier='foo'))
    assert not agreement.belongs_to(MagicMock(identifier='bar'))
开发者ID:k3njiy,项目名称:indico,代码行数:4,代码来源:agreements_test.py

示例13: test_is_orphan

def test_is_orphan(dummy_event_new):
    agreement = Agreement(event_new=dummy_event_new)
    agreement.is_orphan()
    agreement.definition.is_agreement_orphan(agreement.event_new, agreement)
开发者ID:OmeGak,项目名称:indico,代码行数:4,代码来源:agreements_test.py

示例14: _merge_users

def _merge_users(target, source, **kwargs):
    Agreement.find(user_id=source.id).update({Agreement.user_id: target.id})
开发者ID:MichelCordeiro,项目名称:indico,代码行数:2,代码来源:__init__.py

示例15: test_render

def test_render():
    agreement = Agreement()
    agreement.render(None)
    agreement.definition.render_form.assert_called_with(agreement, None)
开发者ID:k3njiy,项目名称:indico,代码行数:4,代码来源:agreements_test.py


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