autoadd class properties

manstey manstey at csu.edu.au
Fri Dec 8 03:38:13 EST 2006


I have a ClassWrapper that wraps around a third party database object.
Each database object has a set of properties, like columns in a
relational database.

I want my wrapper to generate a property for each database object and
load its value into it.

Thus, in my database (which is an oodbms) say I have a MyDbaseClass
with MyProperty1, MyProperty2, etc, after it is loaded, I have:

dbase_object = LoadMyDbaseClass
PythonDbaseClass = PythonWrapper(dbase_object)

I can then load in a list of ['MyProperty1','MyProperty2', etc].

But how can I turn these list elements into PythonDbaseClass
properties, so that I could then simply have:

print PythonDbaseClass.MyProperty1
PythonDbaseClass.MyProperty2="4" 

Is this clear?




More information about the Python-list mailing list