> >>>> I use so called SubObjects for excactly this purpose:
> >>>>
> >>>> http://paste.turbogears.org/paste/1684
> >>>>
> >>> Greg, assuming that if you delete an object that has been commented on
> >>> you want the comments to get deleted automatically then how do you do
> >>> this? You over-write the destroySelf method of the object in question?
> >> At the moment I do this manually, but patches are welcome :-)
> >>
> >> Greg
> >
> > Greg, I don't quite get how you use your code. Using a mixin class
> > doesn't seem to work for me as expected, the magic method _get_xxxxx
> > does not get converted into attribute access in the same way as a
> > similarly named method defined directly in the class (and not the
> > mixin) would:
>
> I am sorry I missed to copy & paste
> one line:
>
> class CommentMixin(BaseMixin):
>
>      additional_attributes = ["comments"]
>      def _get_comments(self):
>          return self._select_sub_objects(Comment, Comment.q.id, False)
>
>      comments = property(_get_comments)
>
> The _get methods are only converted to properties if the object is
> inherited from SQLObject.
>
> Gregor

Thanks, now everything works as expected.

Cheers,
Daniel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to