I'm in situation where it would be convenient to specify a value for 
createJoinTables at class definition time. At present, I'm doing so with 
my own code:

class MyTable(SQLObject):
   ...
MyTable.createTableArgs = { 'createJoinTables': False }

...and later...

classNames = set(locals())
for clsName in list(classNames):
   cls = locals()[clsName]
   if (isinstance(cls, type) and issubclass(cls, SQLObject)
       and cls is not SQLObject
       and cls is not InheritableSQLObject):
     if hasattr(cls, 'createTableArgs'):
       cls.createTable(ifNotExists=True, **cls.createTableArgs)
     else:
       cls.createTable(ifNotExists=True)
   else:
     classNames.remove(clsName)

This *works*, but it's been (rightly, I think) suggested by Jorge Vargas 
on the TurboGears list that it would be more appropriate to just have 
this (either createTableArgs or createJoinTables, specifically) be 
definable through sqlmeta.

What's 'yall's take? If it's a Good Idea, I don't mind whipping together 
a patch myself.



_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to