Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1061 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

Superfluous activemapper relations in quickstart model.py template

Reported by: ghiggins Owned by: anonymous
Priority: normal Milestone: 1.0b2
Component: Toolbox.Catwalk Version:
Severity: normal Keywords: sqlalchemy identity quickstart
Cc:

Description (last modified by jorge.vargas) (diff)

File: root/trunk/turbogears/qstemplates/quickstart/+package+/model.py_tmpl

delete lines 196, 213-214, in both cases the "groups" relation is defined by the backref parameter supplied on lines 178 and 179 respectively.

In use, any access of identity.current.permissions causes an AttributeNotFound? exception in the loop on line 200.

I posted a failing test based on Group and User to the sqlalchemy group and Michael Bayer confirmed:

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

Change History

comment:1 Changed 13 years ago by jorge.vargas

  • Component changed from Toolbox to Toolbox.Catwalk
  • Description modified (diff)
  • Milestone set to 1.0b2

please provide a patch and will be added to the next release.

comment:2 Changed 13 years ago by jorge.vargas

was this fix with r1997 and the change for mapping?

comment:3 Changed 13 years ago by splee

  • Status changed from new to closed
  • Resolution set to fixed

Yes, this was fixed with r1997. Until ActiveMapper? is a little more stable it seems unwise to use it as the default method of creating SA schemas.

The SA Identity template will be plain SA with assign_mapper in future releases.

Note: See TracTickets for help on using tickets.