[TransWarp] Question: thinking in Zope

Jerry McRae 1Jerry at usd1.com
Mon Feb 11 15:06:31 EST 2002


Hi TransWarpies,
  
Phillip, I talked to you quite a bit at Python 8 (between blizzards in Arlington).  I am glad you are going forward with simplifying development through planning with TransWarp.  I tried to keep this short, but failed


I invite anyone with ideas, please comment on my plans/ question.  (Specific imbedded questions coded a Q1, Q2, etc.)

I am trying to conceptualize how to use TransWarp to add flexibility to my Zope application.  I have many parameters that each user needs to define, quantify, and set on their own.  Right now the design uses folders, sub-folders (with acquisition), and pointers to re-use previous definitions.  I cannot describe completely what I need, both because of the space, and I find it hard to explain succinctly.

On a basic level I have databases of people that gets processed periodically by a set of rules and tables.  10,000 to 10,000,000 people, and 40-400 rules that, depending on fields, control what happens to each record.  Each of my ‘clients’ has their own database of their own people, and creates their own rules sets.

An example.  Each record in client A’s db has a title.  I have a title class, and a title container class.  For each title code on the db, the class can be used to look up things like name of title, pay, etc.  But besides  attributes, there are methods that describe the conditions to promote, demote, do this, and do that.  Client A might create another set of titles (setB) that points to a different column, and has a different set of titles and promotions.

My idea was to have a baseTitleAspect, allow each client to define aspects (via their programmers or me) to weave in to define what a TitleClass means to them.

Let’s say that the titles in setB need another attribute “color”.  We add a simple aspect that defines set and get color, and will have to recreate the class TitleClass from (baseTitleAspect, colorAspect).  Q1:I _think_ that will require a Product Refresh, to re-set the classes, yes?  If their main set of titles has one that needs a ‘skip’ function, should I (Q2) re-do the whole TitleClass with a new aspect, or just create a sub-class and use it for the one item?  Q3 is there a ‘better’ or ‘conventional’ way of structuring this, or is it all designer preference?

Also, if I find some common aspects that are used by several clients, I could place them higher up in the chain, so they could be used by all clients.

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?

--Jerry
 /\_/\    Jerry McRae       \|||/       mail safely: The Bat! 1.53d
(~o o~)  (stuck in win98)   (. .)       Zope v2.4.1  - dryer than golf
 )'Y'(   _______________-o00-(_)-00o-____________________________________
(     ) / ...Put knot yore trust inn spiel chequers,
          two bee spelt write is naught aqueduct.





More information about the PEAK mailing list