|
From: Bud P. B. <bu...@si...> - 2003-04-28 17:22:12
|
Here are two beginner questions that I hope someone can help me with:
1. is it possible that I have to assign __connection__ before defining
subclasses of SQLObject? When I don't do this, I seem to run into
problems.
2. is there a way to control redundancy in the following example:
class test1 (SQLObject):
_columns = [StringCol("lang", lenght=2, default='en'),
IntCol("someOtherStuffHere")]
class test2 (SQLObject):
_columns = [StringCol("lang", lenght=2, default='en'),
StringCol("differentStuffThanInTest1")]
I would like to decide only once how to represent a language in the
DBMS and use this consistently in various class definitions.
I unsuccessfully tried to define a StringCol object, langCol, before
and use it in the _columns definition. This does not seem to work if
I use it in more than one class though.
I also tried to define a function that returns an instance of
StringCol, but this didn't even work once...
I hope someone can point out what I'm doing wrong!
Many thanks
--b
/-----------------------------------------------------------------
| Bud P. Bruegger, Ph.D.
| Sistema (www.sistema.it)
| Via U. Bassi, 54
| 58100 Grosseto, Italy
| +39-0564-411682 (voice and fax)
\-----------------------------------------------------------------
|