[SQLObject] Objects with localized properties
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: deelan <de...@in...> - 2003-05-07 09:34:29
|
hi there, i'm new to sqlobject and python in general, i'm developing using .net framework but i'm dissatisfied of the system for a number of reasons, one of them is the lack of proper ORM tool. microsoft has objectspace under development but the current "tech preview" it's just a demo, e.g. you can't do many-to-many relations. so i'm thinking to switch to python, webware, cheetah and sqlobject. i've read the docs and i was wondering how can i solve some tipical challenges i'm having while i develop web app with .net. it happens quite often to have to deal with some business objects that have multiple strings (names, descriptions, etc.) to help app localization. just think about a product in a catalogue that needs two, three descriptions based on the locale of the user browsing the page. how would you model the object? if you retrieve the object from the db with: p1 = Product(10) the object would contain all the possibile names in the implemented locales? what about a: p1 = Product(10, 'it') p1.name <-- get italian localized name to load up just the italian name and description for the product? i think this would case some issues, since if i do: p2 = Product(10, 'en') p2 is really the same object in the DB but now contains english name and description. probably this solution make more sense: p1 = Product(10) p1.setLocale('it') p1.name <-- get italian name p1.setLocale('en') p1.name <-- get english name finally i would like to avoid doing this: p1 = Product(10) p1.nameEn <-- return english name p1.nameIt <-- return italian name since when a new locale is added i need to add a new variable. what are your thoughts? thanks is advance. |