[storm] Dynamically changing OR mapping question with aliases
Gustavo Niemeyer
gustavo at niemeyer.net
Thu Aug 9 19:23:25 BST 2007
> so depending on what the user chooses, the right database would be
> chosen and consecutively the right data would be displayed, I just do:
>
> Link.__storm_table__ = session.userlang
That's certainly not what you want. Doing so you're changing the class
globally, for all threads and objects that exist in memory, which means
it will create all kinds of inconsistencies.
Instead, you can just define a new classes reflecting what you
actually have:
class LinkInEnglish(Link):
__storm_table__ = "link_table_in_english"
class LinkInGerman(Link):
__storm_table__ = "link_table_in_german"
--
Gustavo Niemeyer
http://niemeyer.net
More information about the storm
mailing list