On Wednesday 10 January 2007 15:48, kerinin wrote:
> That helps:
>
> ------------------
> class BaseClass(InheritableSQLObject):
> base_reference = ForeignKey('RefClass', default=None)
>
> def _get_reference(self):
> return self.base_reference
> def _set_reference(self,value):
> self.base_reference = value
>
> class OtherClass(BaseClass):
> other_reference = ForeignKey('RefClass', default=None)
>
> def _get_reference(self):
> return self.other_reference
> def _set_reference(self,value):
> self.other_reference = value
>
> class RefClass(SQLObject):
> base_classes =
> MultipleJoin('BaseClass',joinColumn='base_reference_id')
> other_classes =
> MultipleJoin('OtherClass',joinColumn='other_reference_id')
> -------------------
>
> this produces the correct behavior if instances of OtherClass are
> created without the reference parameter and then the reference
> parameter is set after instantiation, but the problem still exists if
> you do something like this:
>
> ref=RefClass()
> other=OtherClass(reference=ref)
>
> It doesn't seem to use the overloaded get and set methods when creating
> the object.
You can override the _create-method in both classes and map reference to the
respective property that is really needed.
Diez
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---