Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(1)  |  Derive(0)  |  Import(1)
    

        def JournalEntryHandler(event):
    """
    """
    obj = event.object
    comment = event.comment

    try:
        journalizable = IJournalizer(obj)
    except:
        return
    
    if event.action is None:
        action = _(u"label_journal_entry", default=u"Journal Entry")
    else:
        action = event.action

    if event.actor is None:
        portal_state = getMultiAdapter((obj, obj.REQUEST), name=u'plone_portal_state')
        actor = portal_state.member().getId()
    else:
        actor = event.actor
 
    if event.time is None:
        time = DateTime()
    else:
        time = event.time
    
    journalizable(action, comment, actor, time)
        


src/f/t/ftw.journal-1.2.7/ftw/journal/tests/test_unit_events.py   ftw.journal(Download)
from ftw.journal.events.events import JournalEntryEvent
from ftw.journal.events.handlers import JournalEntryHandler
from ftw.journal.interfaces import IJournalizer
from plone.mocktestcase import MockTestCase
from zope.interface import Interface
 
        # Call function
        JournalEntryHandler(mock_event)
 
        # Return the values