I've got some object classes related like so: class ObjectState(SQLObject): parent = ForeignKey('Object') date = DateCol() attribute = StringCol()
class Object(SQLObject): states = MultipleJoin('ObjectState', joinColumn='parent_id') When I subclass them, I don't want to have to keep repeating the ObjectState.parent and Object.states attribute definitions. I'd like to autogenerate the string arguments passed to ForeignKey and MultipleJoin, based on the name of the class. Ideally it would look something like this: class ObjectState(SQLObject): parent = ForeignKey(class.__name__[:-5]) date = DateCol() attribute = StringCol() class Object(SQLObject): states = MultipleJoin(class.__name__+'State', joinColumn='parent_id') Which leads to some questions: 1) How do I access the name of the class in the class definition? 2) If I can set these parent/states attributes like this, will it inherit correctly for subclasses? I'd appreciate help from somebody who's set up something like this before, or else suggestions on other means of accomplishing this goal. TIA, cs ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss