Ian,
I have successfully been using SQLObject svn trunk for a few days now,
without modifications. I have implemented automatic class generation
by reading information from the database about classes and their
columns and joins. I did this by extending MetaSQLObject with my own
behavior, and a factory method called getClass(classname), which checks
the registry, and then constructs a new class if the registry does not
contain the proper class.
The problem I am running into now, is when you have joined classes, the
joined classes have to be explicitly loaded. In your users/roles
example, my code would have to look something like this:
userClass = getClass('user')
roleClass = getClass('role') #if this is not called here, user.roles
will not be defined, because the role class is not in the registry
user = userClass.get(1)
print list(user.roles[0])
It would great if the registry was allowed to have a factory method set
to attempt automatic class creation if the class does not exist. If I
coded this up as a patch, would it be accepted?
Thanks,
Scott
|