[Grok-dev] Bug report, megrok.rdb, SQLAlchemy 0.6.6, zope.sqlalchemy 0.6.1

Christian Klinger cklinger at novareto.de
Tue Feb 22 15:10:47 EST 2011


Hello Marco,

thanks for your report. I updated the buildout to the new versions of 
sqlalchemy. You can see my changeset here:

http://zope3.pov.lt/trac/changeset/120519

Happy grokking
- Christian

>    Dear grok team
>
> I use megrok.rdb for a current project. I checked out the current
> version of megrok.rdb. It install SQLAlchemy 0.6.6 and zope.sqlalchemy
> 0.6.1 as dependences. If I define a relation on my rdb.Model it appear
> the following error:
>
>       AttributeError: 'PrimaryKeyConstraint' object has no attribute 'keys'
>
> SQLAlchemy change the PrimaryKeyConstraint in newer versions.
>
>
> Solution for the problem:
>
> components.py:
>
> OLD:
> def default_keyfunc(node):
>       primary_keys = node.__table__.primary_key.keys()
>       if len(primary_keys) == 1:
>           return getattr(node, primary_keys[0])
>       else:
>           raise RuntimeError(
>               "don't know how to do keying with composite primary keys")
>
> NEW:
> def default_keyfunc(node):
>       primary_keys = node.__table__.primary_key.columns.keys()
>       if len(primary_keys) == 1:
>           return getattr(node, primary_keys[0])
>       else:
>           raise RuntimeError(
>               "don't know how to do keying with composite primary keys")
>
> Chears
> Marco Lempen




More information about the Grok-dev mailing list