Per subject. This is impacting the TurboGears identity provider table 
creation code, which tries to call 
class_mapper(user_class).props['groups'].secondary but is unable to find 
'groups' (a many_to_many relationship) in the properties list.

I'm able to reproduce this with a minimalist test case:

 >>> from sqlalchemy.ext.activemapper import *
 >>>
 >>> engine = create_engine('sqlite:///:memory:')
 >>> conn = engine.connect()
 >>>
 >>> foo_bar_map_table = Table('foo_bar_map', engine,
...   Column('foo_id', Integer, ForeignKey('foo_tbl.foo_id'), 
primary_key=True),
...   Column('bar_id', Integer, ForeignKey('bar_tbl.bar_id'), 
primary_key=True))
 >>>
 >>> class Foo(ActiveMapper):
...   class mapping:
...     __table__ = 'foo_tbl'
...     foo_id = column(Integer, primary_key=True)
...     foo_text = column(String(30))
...     bars = many_to_many('Bar', foo_bar_map_table, backref='foos')
...
 >>> class Bar(ActiveMapper):
...   class mapping:
...     __table__ = 'bar_tbl'
...     bar_id = column(Integer, primary_key=True)
...     bar_text = column(String(30))
...     foos = many_to_many('Foo', foo_bar_map_table, backref='bars')
...
 >>> from pprint import pprint
 >>> pprint(class_mapper(Foo).props)
{'foo_id': ColumnProperty(['foo_tbl.foo_id']),
  'foo_text': ColumnProperty(['foo_tbl.foo_text'])}

If the assumptions made in the TurboGears identity provider code were 
accurate, class_mapper(Foo).props would contain an element associated 
with 'bars'; in practice, it does not.

Is this an issue with ActiveMapper, or with the assumptions made by the 
TurboGears identity provider? I'm working with TurboGears trunk r1557 
and SQLAlchemy trunk r1622.



_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to