autoadd class properties

Gabriel Genellina gagsl-py at yahoo.com.ar
Fri Dec 8 22:57:10 EST 2006



On 8 dic, 20:59, "manstey" <mans... at csu.edu.au> wrote:
> We've looked at them a little. Cache is a native OO dbase, so there is
> no ORM required. Cache does that for you behind the scenes if you need
> it to. What I want is to translate Cache classes and properties into
> Python classes and properties. We can only use class wrappers, because
> cache uses old style python objects, but this still works.
>
> Because I am not an experienced programmer, the problem I face is how
> to load ANY Cache class, whose properties the wrapper doesn't know in
> advance, and turn the class properties into python properties.
>
> So in Cache, I might have Name = String, Age = Integer, Colours = List,
> in the class Person. The python binding provided by Cache creates a
> Person class in Python, but it provides none of its properties, so I
> want to write a wrapping class that adds the properties. Can you advise
> me on how to do this?

Still unclear... Don't you have a way to iterate over all the
properties? Have you tried using dir() on the generated class?
BTW, do you know ZODB? It's an OO database written in Python and mostly
transparent for the user. You just write and use your objects as always
and the persistence mechanism does the rest.

-- 
Gabriel Genellina




More information about the Python-list mailing list