[PEAK] Persistence styles, MDA, AOP, PyProtocols, and PEAK

Phillip J. Eby pje at telecommunity.com
Fri Jul 16 17:45:46 EDT 2004


At 01:51 PM 7/16/04 -0700, John Landahl wrote:

>I'd like to hear more about your event/validation machinery ideas when you 
>get
>a chance.

It's really very simple, actually.  I anticipate that any modification of a 
feature on any model object will call a generic function that takes 
arguments for the objects in question and the kind of association between 
them.  The default implementation will update the object's attributes to 
point at each other (or not).

To do validation, you'll add before, after, or around methods to the 
generic function, e.g.:

     [before("linkType is foo and (some validation condition)")]
     def link(linkType,ob1,ob2,...):
         raise ValueError("Now that just ain't right...")

Of course, the devil is in the details here, in that I don't know what the 
arguments are or how many there are, whether we'll use different generic 
functions for each association, or one gigantic one, or maybe even both.

Also, for delayed-evaluation constraints, there'll probably be some sort of 
'validate' generic function to evaluate all possible issues with a transaction.

Actually, I think it's more likely that one of the parameters here will be 
the workspace (editing context), and rather than raising errors, one will 
pass validation error info to the workspace.  Some workspaces will 
accumulate this info for the use of the UI (like a set of errors to be 
displayed on a web or GUI input form), and others will issue an error 
immediately.




More information about the PEAK mailing list