← Back to team overview

divmod-users team mailing list archive

Axiom change logging

 

Hi,

I currently have some tooling + a decorator that logs when an item is first
created (more technically correct: first added to a store) by using the
activate callback.

I would also like to log *changes* for some stuff. I'm not entirely sure
yet if this is even a solvable problem (for example, what happens across
schema changes?), or which

ie given an item:

class Shield(Item):
    value = integer()

s = Shield(store=myStore, value=1)
s.value = 10
s.value = 5

Then I should see the changes from 1 to 10 and 10 to 5 in MyStore
somewhere. I'm pretty flexible as to how this happens (the most important
part is logging the changes at all; efficient querying or access of them is
a bit of an afterthought).

I'd imagine an item like so:

class Change(Item):
    onObject = attributes.reference()
    attribute = attributes.bytes()
    old = attributes.text()
    new = attributes.text()

... where there is some bidirectional mapping of attribute types from and
to those text values.

How can I do this?

cheers
lvh

Follow ups