Daniel Haus wrote:
> The quickstart-generated model.py worked for me as soon as I took out
> the (in my eyes) superfluous many_to_many-properties.
Yes, you are correct. I also had it confirmed by Michael Bayer. The
qs-generated model throws AttributeError when User.groups is accessed
(via User.permissions). I hacked up a test and posted it to the
sqlalchemy group. Michael replied:
-------------
OK, well theres not too much of a bug here, except that when
ActiveMapper has a circular relationship between two classes (comprised
of more than one relationship(), that is), it fails to set up the
relationships on either class. theres no immediate fix for this;
while the compilation of plain (non-Active) mappers is able to handle a
circular relationship like that, the way activemapper compiles on top
of it is not quite as flexible. jonathan and i had talked about a way
to add some extra string-based argument capabilities to
Mapper/relation() so that a lot more of the compilation code in
ActiveMapper could just be removed which would probably eliminate this
issue.
however, the reason its not super-critical is because this relationship
is a backref relationship, which means youre only supposed to set it up
on one class, where "backref" handles the other direction:
class foo(activemapper.ActiveMapper):
class mapping:
name = column(String(30))
class baz(activemapper.ActiveMapper):
class mapping:
name = column(String(30))
foorel = many_to_many("foo", secondarytable,
backref='bazrel')
------------
I did exactly what you and Michael recommend and excised the "groups"
column declaration from the User class and now tg.identity (mostly)
works as expected.
I write "mostly" because there is a persistent sqlalchemy error report
in the output log when TG tries to expire a session. Somewhere on the
sqlalchemy list there's a reference to an identical error and a Michael
Bayer fix. I'll look it up when I get time.
For context: I have been re-engineering Eli Yukelzon's "TurboBlog" to
use sqlalchemy, sort of using it as an extended test/learning suite for
getting to grips with sqlalchemy under TG.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---