#1061: Superfluous activemapper relations in quickstart model.py template
--------------------------------------------+-------------------------------
 Reporter:  ghiggins                        |        Owner:  anonymous
     Type:  defect                          |       Status:  new      
 Priority:  normal                          |    Milestone:  1.0b2    
Component:  Toolbox.Catwalk                 |      Version:           
 Severity:  normal                          |   Resolution:           
 Keywords:  sqlalchemy identity quickstart  |  
--------------------------------------------+-------------------------------
Changes (by jorge.vargas):

  * milestone:  => 1.0b2
  * component:  Toolbox => Toolbox.Catwalk

Old description:

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

New description:

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

Comment:

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

-- 
Ticket URL: <http://trac.turbogears.org/turbogears/ticket/1061>
TurboGears <http://www.turbogears.org/>
TurboGears front-to-back web development
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Tickets" 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-tickets
-~----------~----~----~----~------~----~------~--~---

Reply via email to