You are not logged in Log in Join
You are here: Home » Members » Phillip J. Eby's Zope Center » My Wikis » ZPatterns Wiki » DataManagementEvents » wikipage_view

Log in
Name

Password

 
 
DynamicDataObjects »

DataManagementEvents

Events sent to DataManagers by DataSkins:

  • manager._objectAdding(skin) -- called by a skin's manage_afterAdd() method if stored in a Zope ObjectManager, or by a Rack's newItem() method if stored in a Rack. DataManagers forward this event as-is to AttributeProviders and SheetProviders.
  • manager._objectDeleting(skin) -- called by a skin's manage_beforeDelete() method if stored in a Zope ObjectManager, or by the skin's manage_delete() method if stored in a Rack. DataManagers forward this event as-is to AttributeProviders and SheetProviders, and also use it to know that they should ask agents to take a "before" snapshot. (See below.)
  • manager._objectChanging(skin) -- called by AttributeProviders and SheetProviders before making any change to an object's data, whether that data is stored "inside" or "outside" the object. DataManagers use this event to know that a skin is changing, so that they can ask agents to snapshot the object and then compare against that snapshot at commit time. (See below.)

Events sent to RuleAgents and IndexingAgents by DataManagers:

  • agent._getMementoFor(skin) -- called by DataManagers to get a "before" snapshot of an object which is being changed or deleted, from the viewpoint of the agent. IndexingAgents might return the data stored in the index for that object, and RuleAgents might return the values of fields they are interested in "before" values of. This method is called at the first occurrence of an _objectChanging() or _objectDeleting() event for a given skin, within a transaction or subtransaction.

    SteveA: A quote from Design Patterns (Gamma et al.) might be useful here. (I think this is allowed under "fair use" copyright law.) From page 283:

    "Memento: intent: Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later."

  • agent._objectChanged(skin,memento) and agent._objectDeleted(skin,memento) -- called by DataManagers at transaction or subtransaction commit to inform the agent that the object has changed or been deleted. A "before" memento is included, as previously requested from the agent earlier in the transaction or subtransaction.
  • agent._objectAdded(skin) -- called by DataManagers at transaction or subtransaction commit to inform the agent that a new object has been added. This message is only sent if the object did not send an _objectDeleting() message to cancel out the add.

(Note that if an object was renamed or moved using the Zope management interface, it will be treated as an _objectChanged() event rather than as an _objectDeleted() followed by _objectAdded().)

Currently, there is no support for the concept of an object being copied, but perhaps there should be. However, DataManagers recognize which object is which for event management purposes by their Python pointer (id(object)) value, which means that when a copied object was created, they would have no way of knowing what object the copy was taken from.