objecthistory – Components for Object Histories Module

class waeup.kofa.objecthistory.ObjectHistory(context)[source]

Bases: grokcore.component.components.Adapter

A history for objects.

For any object implementing IKofaObject which is annotatable, we provide histories. A history for such an object can be obtained by adapting it to IObjectHistory.

__doc__ = 'A history for objects.\n\n For any object implementing `IKofaObject` which is annotatable,\n we provide histories. A history for such an object can be obtained\n by adapting it to `IObjectHistory`.\n '
__implemented__ = <implementedBy waeup.kofa.objecthistory.ObjectHistory>
__module__ = 'waeup.kofa.objecthistory'

Special descriptor for class __provides__

The descriptor caches the implementedBy info, so that we can get declarations for objects without instance-specific interfaces a bit quicker.

For example:

>>> from zope.interface import Interface
>>> class IFooFactory(Interface):
...     pass
>>> class IFoo(Interface):
...     pass
>>> class C(object):
...     implements(IFoo)
...     classProvides(IFooFactory)
>>> [i.getName() for i in C.__provides__]
>>> [i.getName() for i in C().__provides__]
addMessage(msg, user=None)[source]

Add the message (history entry) in msg.

Any message will be stored with a timestamp and the current user (principal) if user parameter is None.

history_key = 'waeup.history'

Get all messages as a persistent list of strings.

modifyMessages(old, new)[source]

Replaces history messages.

Substring ‘old’ will be replaced by ‘new’ in all messages.


Removes a single history message.