Пример #1
0
    def test_querying(self):
        soup = get_activity_soup()
        document = create(Builder('document'))
        soup.clear()

        with freeze(datetime(2010, 1, 1)):
            object_added(document)
        with freeze(datetime(2010, 1, 2)):
            object_changed(document)
        with freeze(datetime(2010, 1, 3)):
            object_changed(document)

        results = map(lambda record: (record.attrs['action'], record.attrs['date']),
                      query_soup(Eq('action', 'changed'),
                                 sort_index='date',
                                 reverse=True))

        self.assertEquals([('changed', DateTime('2010/01/03')),
                           ('changed', DateTime('2010/01/02'))],
                          results)
Пример #2
0
    def test_add_activity(self):
        document = create(Builder('document').titled('The Document'))
        with freeze(datetime(2010, 12, 25, 13, 30)):
            record_id = object_added(document)
        record = get_activity_soup().get(record_id)

        self.assertEquals({'path': '/plone/the-document',
                           'allowed_roles_and_users': ['Anonymous'],
                           'uuid': 'testaddactivity00000000000000001',
                           'portal_type': 'Document',
                           'title': 'The Document',
                           'timestamp': 1293280200000L,
                           'action': 'added',
                           'date': DateTime('2010/12/25 13:30:00'),
                           'actor': TEST_USER_ID},
                          dict(record.attrs))
Пример #3
0
def make_object_added_activity(context, event):
    object_added(context)
Пример #4
0
def make_object_added_activity(context, event):
    if not is_supported(context) or IPloneSiteRoot.providedBy(event.object):
        return None

    object_added(context)