[storm] Audit trail / Change log
Gerdus van Zyl
gerdusvanzyl at gmail.com
Fri Aug 29 14:05:30 BST 2008
By reading the source I came up with the following code. It seems to
work. I am always pleasantly surprised at storm's flexibility.
(warning non-relevant code omitted,won't run as is)
from storm.info import get_obj_info
from storm import Undef
# in eg. constructor
store = getStore()
obj_info = get_obj_info(self)
self._enable_change_notification(obj_info)
def _enable_change_notification(self, obj_info):
obj_info.event.hook("changed", self._variable_changed)
def _variable_changed(self, obj_info, variable,
old_value, new_value, fromdb):
if not fromdb:
if new_value is not Undef and new_value is not AutoReload:
print 'Change:',variable.column.name,old_value,new_value
On Tue, Aug 26, 2008 at 12:09 PM, Gerdus van Zyl <gerdusvanzyl at gmail.com> wrote:
> Hi,
>
> I want to create an audit/change log for my storm objects.
> The logic should be in __storm_pre_flush__ I assume but where in storm
> can I check if a property has changed? as in different from the
> database?
>
> The log/table I want to create looks like this:
> property | old value | new value | date
>
> Thank you,
> gerdus
>
More information about the storm
mailing list