Modified Event Handler for Dexterity Form Field?

Dexterity edit forms attach info to the ObjectModifiedEvent about which field(s) was modified. You can write a handler like this:

def handle_modified(object, event):
    if hasattr(event, 'descriptions') and event.descriptions:
        for d in event.descriptions:
            if d.interface is IMySchema and 'my_field' in d.attributes:
                # do things here

Unfortunately there isn't a way to get the old field value from the event handler, though.

2 Likes