= Plomino audit trail and change notifications =
An audit trail is a way to go back and see how data was changed in the system.
What changed, and who made the changes.
It isn't necessarily complete; i.e. only stored items are remembered, not
dynamically computed items.
== Proposed changes to Plomino ==
# Make `PlominoDocument.setItem` return the old value, or an (old, new) tuple.
# Make `PlominoDocument.save` use these values to return a dictionary of
changes: `{'itemid': {'old': oldvalue, 'new': newvalue}, ...}`
These two changes would enable interested scripts to look at the return values,
e.g. to compose a mail with a summary of the changes. For showing just what
changed, there are a few diff implementations available to Plomino, e.g.
`zope/tal/ndiff.py`, `lxml/html/diff.py`, `Products/CMFDiffTool`.
# Make an audit adapter for `PlominoDocument`. This would adapt
`PlominoDocument.setItem` to save each version of an item. Possible
mechanisms to use include `zope.app.versioncontrol` and good old
`CMFEditions`. Perhaps a good baseline would be simply to log the new value
to subscribing logger(s), as long as all values are printable.
Implications for computed-for-display fields need to be considered. Computed
fields are stored, so they will be logged. Changes in these field values will
derive from changes to items that are being audited, but the relations may not
be obvious (e.g. to find out what the value of `ComputedFieldX` was at some
point in time -- one would have to go back to the values of formulas in that
point in time. The only dependable way would be to roll back to a snapshot of
the entire Zope instance, code, data and all).