コード例 #1
0
ファイル: tests.py プロジェクト: ale-rt/z3c.relationfield
 def test_break_relations_missing_catalog(self):
     # Remove relations catalog and ensure the event handler doesn't fail
     unregister_fake_catalog()
     try:
         event.breakRelations(ObjectEvent(self.content))
     except ComponentLookupError:
         self.fail("breakRelations fails when catalog utility is missing")
コード例 #2
0
ファイル: tests.py プロジェクト: ale-rt/z3c.relationfield
 def test_missing_intids(self):
     """Event handlers which trigger on object removal should not
     throw exceptions when the utilities are missing.  The utilities may
     have been deleted in the same transaction (e.g. site deletion)."""
     # Remove intid utility and ensure the event handler doesn't fail
     unregister_fake_intid()
     try:
         event.breakRelations(ObjectEvent(self.content))
     except ComponentLookupError:
         self.fail("breakRelations fails when intid utility is missing")
コード例 #3
0
def workflowTransitionEventDispatcher(event):
    source = event.source
    destination = event.destination

    iface = workflow_transition_event_map.get(
        (type(event.object), source, destination))

    if iface is None:
        for specification in interface.providedBy(event.object):
            iface = workflow_transition_event_map.get(
                (specification, source, destination))
            if iface is not None:
                break

    if iface is not None:
        transition_event = ObjectEvent(event.object)
        interface.alsoProvides(transition_event, iface)
        notify(transition_event)