I haven't had to work with it, but it looks like it's already in
sqlobject... Try:
from sqlobject.joins import SingleJoin
I don't know the history behind SingleJoin, but Google might :)
On 2/26/06, Olli Wang <[EMAIL PROTECTED]> wrote:
>
> hi, could I assign particular object for SingleJoin? I have a class
> like this:
>
> class AlbumCategory(SQLObject):
> cover = SingleJoin("AlbumPhoto", joinColumn='album_id')
>
> class AlbumPhoto(SQLObject):
> album = ForeignKey("AlbumCategory")
>
> # Test in shell
>
> In [33]: a = AlbumCategory.get(1)
>
> In [34]: a
> Out[34]: <AlbumCategory 1 name=u'yuri' description=u'' userID=1
> block=False>
>
> In [35]: p = AlbumPhoto.get(2)
>
> In [36]: p
> Out[39]: <AlbumPhoto 2 real_name="u'200602270206015...'"
> original_name=u'205' de
> scription=u'' albumID=1 cover=False>
>
> In [37]: a.cover
> Out[37]: <AlbumPhoto 1 real_name="u'200602270204565...'"
> original_name=u'1123614
> 046' description=u'' albumID=1 cover=False>
>
> ## I want to change the cover to another, but got traceback.
> In [38]: a.cover = p
> ---------------------------------------------------------------------------
> exceptions.AttributeError Traceback (most
> recent call
> last)
>
> E:\TurboGears\myrs\<console>
>
> AttributeError: can't set attribute
>
> any ideas? thanks.
>
>
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---