Why are you using eval anyway? You don't need it here.
if issubclass( getattr( HelpDatabaseModel, value ), SQLObject ):
... and ...
for c in classes:
gatattr( HelpDatabaseModel, c ). _connection = __connection__
Sean
percious wrote:
> Ok, so I *sorta* took your advice, but came up with a more *generic*
> solution:
>
>
> import ft8.turboLink.help.HelpDatabaseModel as HelpDatabaseModel
>
> classes=[]
> for value in dir(HelpDatabaseModel):
> #print value
> try:
> #print "HelpDatabaseModel.%s"%value
> if issubclass(eval("HelpDatabaseModel.%s"%value), SQLObject):
> if value!='SQLObject':
> classes.append(value)
> except:
> pass
>
> del(HelpDatabaseModel)
>
> from ft8.turboLink.help.HelpDatabaseModel import *
>
> for c in classes:
> exec("%s._connection = __connection__"%c)
>
> A true hack, complete with the usual execs and evals. However,
> I can update my helpdatabasemodel file to my hearts content and never
> have to touch model.py.
>
> Also, I can USE helpdatabasemodel in other code without it croaking.
> Win Win? Eh?
>
> What does everyone think?
>
> -percious
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---