[storm] Dynamically changing OR mapping question with aliases
akira
nhytro-python at web.de
Thu Aug 9 18:22:08 BST 2007
Ok, I´ll explain again :-) I have to develop a multilingual site, all
the content and link are coming from tables that I have separated by
language into schemas
example:
en.content # table for English content
de.content # table for German content
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
Then I can make queries on the database
was that clear?
Gustavo Niemeyer wrote:
> Hey Akira,
>
>
>> I have to use PostgreSQL Schemas for separating language tables, using
>> my mapped class, I can reassign the "__storm_table__" value to reflect
>> the schema that I´ll like to act on.
>>
>
> You say that you can reassign it, but I don't understand the reason
> to do so. Can you describe what you're actually trying to perform
> and why?
>
>
>> Link.__storm_table__ ="links"
>>
>> checking up however:
>> print all.__storm_table__
>> print Link.__storm_table__
>>
>> gives me:
>> _1
>> links
>>
>
> Right, that looks expected. The first is the automatic alias
> name, since you didn't provide one, and the second is the table
> name you just assigned to that attribute.
>
>
>> Does the reassignment cascade to the table aliases?
>>
>
> Nope. No magic is happening. It's just an attribute assignment.
>
>
>> Why does it just return the index number( the number increase per
>> created alias) instead of the real table name?
>>
>
> The real class has the real table name, while the alias class
> has the alias table name.
>
>
>> Is this the proper way to do this?
>>
>
> To do what? :-)
>
>
More information about the storm
mailing list