[Sqlalchemy-tickets] [sqlalchemy] #2176: error comparing assocation proxy of attribute mapped colle
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2011-05-25 15:39:00
|
#2176: error comparing assocation proxy of attribute mapped collection
---------------------------------------+------------------------------------
Reporter: guest | Type: defect
Status: new | Priority: medium
Milestone: | Component: access
Severity: no triage selected yet | Keywords:
Status_field: awaiting triage |
---------------------------------------+------------------------------------
I discovered this while writing tests for a model which implements a
dictionary-style access to a column of a related class. I can reproduce
this on SQLAlchemy 0.6.6 and 0.6.7 (have not tried 0.7 yet) using the
attached script. The resulting traceback is:
{{{
Traceback (most recent call last):
File "bin/py", line 98, in <module>
execfile(__file__)
File "/tmp/x.py", line 54, in <module>
assert art.attributes=={'foo': 'bar'}
File
"/Users/wichert/Library/eggs/SQLAlchemy-0.6.7-py2.7.egg/sqlalchemy/ext/associationproxy.py",
line 179, in __get__
proxy = self._new(_lazy_collection(obj, self.target_collection))
File
"/Users/wichert/Library/eggs/SQLAlchemy-0.6.7-py2.7.egg/sqlalchemy/ext/associationproxy.py",
line 227, in _new
self.collection_class = util.duck_type_collection(lazy_collection())
File
"/Users/wichert/Library/eggs/SQLAlchemy-0.6.7-py2.7.egg/sqlalchemy/ext/associationproxy.py",
line 307, in __call__
return getattr(obj, self.target)
File
"/Users/wichert/Library/eggs/SQLAlchemy-0.6.7-py2.7.egg/sqlalchemy/orm/attributes.py",
line 168, in __get__
instance_dict(instance))
File
"/Users/wichert/Library/eggs/SQLAlchemy-0.6.7-py2.7.egg/sqlalchemy/orm/attributes.py",
line 392, in get
return self.set_committed_value(state, dict_, value)
File
"/Users/wichert/Library/eggs/SQLAlchemy-0.6.7-py2.7.egg/sqlalchemy/orm/attributes.py",
line 810, in set_committed_value
collection.append_without_event(item)
File
"/Users/wichert/Library/eggs/SQLAlchemy-0.6.7-py2.7.egg/sqlalchemy/orm/collections.py",
line 560, in append_without_event
getattr(self._data(), '_sa_appender')(item, _sa_initiator=False)
File
"/Users/wichert/Library/eggs/SQLAlchemy-0.6.7-py2.7.egg/sqlalchemy/orm/collections.py",
line 1418, in set
key = self.keyfunc(value)
TypeError: attribute name must be a string
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2176>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|