Esempio n. 1
0
    def execute_rules(event):
        """ When an action is invoked on an object,
            execute rules assigned to its parent.
            Base action executor handler """
        if is_portal_factory(event.object):
            return

        execute(aq_parent(aq_inner(event.object)), event)
Esempio n. 2
0
 def execute_rules(event):
     """ When an action is invoked on an object,
         execute rules assigned to its parent.
         Base action executor handler """
     if is_portal_factory(event.object):
         return
 
     execute(aq_parent(aq_inner(event.object)), event)
Esempio n. 3
0
def copied(event):
    """When an object is copied, execute rules assigned to its parent
    """
    obj = event.object
    if not (IContentish.providedBy(obj) or IComment.providedBy(obj)):
        return

    if is_portal_factory(obj):
        return

    execute(aq_parent(aq_inner(event.original)), event)
Esempio n. 4
0
def copied(event):
    """When an object is copied, execute rules assigned to its parent
    """
    obj = event.object
    if not (IContentish.providedBy(obj) or IComment.providedBy(obj)):
        return

    if is_portal_factory(obj):
        return

    execute(aq_parent(aq_inner(event.original)), event)
Esempio n. 5
0
def moved(event):
    """ When an object is renamed/moved,
    execute rules assigned to its new parent."""
    obj = event.object
    if (not event.oldParent or not event.newParent
            or getattr(obj, "_at_creation_flag", None)):
        return
    if is_portal_factory(obj):
        return
    elif IContentish.providedBy(obj):
        execute(event.newParent, event)
    else:
        return
Esempio n. 6
0
def patched_added(event):
    """When an object is added, execute rules assigned to its new parent.

    There is special handling for Archetypes objects.
    """
    if pcrh.is_portal_factory(event.object):
        return

    # The object added event executes too early for Archetypes objects.
    # We need to delay execution until we receive a subsequent IObjectInitializedEvent

    pcrh.init()
    pcrh.execute(event.newParent, event)
Esempio n. 7
0
def modified(event):
    """When an object is modified, execute rules assigned to its parent
    """

    if handlers.is_portal_factory(event.object):
        return

    if hasattr(event.object,'getId'):
        if event.object.getId().split('.')[0]=='file':
            return

    # Let the special handler take care of IObjectInitializedEvent
    if not IObjectInitializedEvent.providedBy(event):
        handlers.execute(aq_parent(aq_inner(event.object)), event)
Esempio n. 8
0
def moved(event):
    """ When an object is renamed/moved,
    execute rules assigned to its new parent."""
    obj = event.object
    if (not event.oldParent or not
            event.newParent or
            getattr(obj, "_at_creation_flag", None)):
        return
    if is_portal_factory(obj):
        return
    elif IContentish.providedBy(obj):
        execute(event.newParent, event)
    else:
        return
Esempio n. 9
0
def archetypes_initialized(event):
    """Pick up the delayed IObjectAddedEvent when an Archetypes object is
    initialised.
    """
    obj = event.object
    if is_portal_factory(obj):
        return

    if not IBaseObject.providedBy(obj):
        return

    cr_handlers.init()
    delayed_event = cr_handlers._status.delayed_events.get(
        'IObjectInitializedEvent-audit-%s' % getUID(obj), None)
    if delayed_event is not None:
        cr_handlers._status.delayed_events[
            'IObjectInitializedEvent-audit-%s' % getUID(obj)] = None
        execute_event(delayed_event)
Esempio n. 10
0
def created_event(event):
    obj = event.object

    if is_portal_factory(obj):
        return

    if IObjectCopiedEvent.providedBy(event):
        return  # ignore this event since we're listening to cloned instead
    # The object added event executes too early for Archetypes objects.
    # We need to delay execution until we receive a subsequent
    # IObjectInitializedEvent
    if IBaseObject.providedBy(obj):
        cr_handlers.init()
        cr_handlers._status.delayed_events[
            'IObjectInitializedEvent-audit-%s' % getUID(obj)] = event
    elif IContentish.providedBy(obj) or IComment.providedBy(obj):
        execute_event(event)
    else:
        return