[TransWarp] Question: thinking in Zope

Phillip J. Eby pje at telecommunity.com
Mon Feb 11 17:41:43 EST 2002


Hi Jerry.  I suggest you take a look at the TW.StructuralModel package - it 
does some similar things to what you're trying to do with metadata.  The 
implementation is about to undergo some significant changes for Python 2.2, 
but the basic ideas will remain much the same.  You might also look at 
TW.Database.DataModel, which is another example of generating classes based 
on metadata, but it's not quite as close in purpose and concept to what 
you're doing as the StructuralModel package is.

At 12:06 PM 2/11/02 -0800, Jerry McRae wrote:
>
>My plan is to have the base aspects separate from the UI, which is what I 
>read into your descriptions.  Q3: My final question (for now), do you have 
>a recommendation on the following:
>
>Instead of

>class base(Aspect):
>     class baseTitle:
>         pay = 0
>         desc = ''
>         order = 0
>         def setPay(self,pay):
>         def getPay(self):
>         def setDesc(self,desc):
>         def getDesc(self):
>         def setOrderUp(self):
>         def setOrderDown(self):
>         def getOrder(self):
>
>
>Something like

>class base(Aspect):
>   Class baseTitle:
>       attrs = {}
>       attrs['desc'] = ('varchar',1 # can access direct
>                              'prompt', 'help text')
>      attrs['pay'] = ('integer', 1, 'pay amount', 'the amount paid per pay 
> period, period.')
>      attrs['order'] = ('integer',0,'sort order','be careful changing this!')
>      def setAttr(self,name,value):
>          if getattr(self,name)[1]:
>             setattr(self,id,value)
>          else: raise Error
>
>I then create a Zope UI aspect to display and set from Zope, without 
>specific code for specific attributes.
>
>I am thinking this second method would make for less repeated setxxx and 
>getxxx methods, and allow general purpose UI mixins (weaveins?).  I then 
>create a weavein for wxPython and my application is already built!
>
>How close am I to the actual purpose of AOP?





More information about the PEAK mailing list