> >> 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:

-------------------------------------------------------------------------------------
from sqlobject import *
from sqlobject import connectionForURI

sqlhub.processConnection = connectionForURI( 'sqlite:///:memory:', debug=True )

class mixin( object ):
    def _get_something( self ):
        return 1

class foo( SQLObject, mixin ):
    def _get_somethingelse( self ):
        return 1
    bar = IntCol( )

foo.createTable( )

f = foo( bar=3 )

print f.bar  # works
print f.somethingelse # works
print f._get_something( ) # works
print f.something # does not work
------------------------------------------------------------------------------------

So it seems only those _get_xxxxxxxxx methods get converted to
ordinary attribute access which were defined directly in the class. In
your code you have _get_comments which I would have guessed is named
such because it will be used as ordinary attribute access, .comments,
but it doesn't work, only as ._get_comments( ).

Am I doing something wrong or you call it as a method, ._get_comments(
), all the time and don't worry about accessing it as .comments?

-------------------------------------------------------------------------
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