Jeff Watkins, el jueves 27 de octubre a las 08:48 me escribiste:
>
> While working on the identity framework for TurboGears, I've been
> trying to come up with a clean way to allow developers to provide
> their own identity model classes. One thought was to load the name of
> the developer's preferred User class and instantiate that instead of
> the default User class.
>
> So this means I have the following model:
>
> class User(SQLObject):
> class sqlmeta:
> table="user_table"
> # meaningful columns left out for brevity
> groups=RelatedJoin( "Group", intermediateTable="user_group",
> joinColumn="user_id", otherColumn="group_id" )
>
> class Group(SQLObject):
> class sqlmeta:
> table="group_table"
> # meaningful group info left out for brevity
> users=RelatedJoin( "User", intermediateTable="user_group",
> joinColumn="group_id", otherColumn="user_id" )
>
> All works great so far. But then I add an override for the User class
> to the config file to specify MyUser instead of User. MyUser is
> defined as:
>
> class MyUser(User):
> # additional package specific stuff
Maybe you have to use InheritableSQLObject?
class User(InheritableSQLObject):
class sqlmeta:
table="user_table"
# meaningful columns left out for brevity
groups=RelatedJoin( "Group", intermediateTable="user_group",
joinColumn="user_id", otherColumn="group_id" )
class MyUser(User):
_inheritable = False
# additional package specific stuff
Reference:
http://www.sqlobject.org/Inheritance.html
--
LUCA - Leandro Lucarella - JID: luca(en)lugmen.org.ar - Debian GNU/Linux
.------------------------------------------------------------------------,
\ GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05 /
'--------------------------------------------------------------------'
Sometimes I think the sure sign that life exists elsewhere in the universe
Is that that none of them tried to contact us