summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-02-09 18:45:11 +0000
committerJason Kirtland <jek@discorporate.us>2008-02-09 18:45:11 +0000
commit2269bee87fe905d2b6f608fa32cf1d35b6e7646f (patch)
tree1ef94494b5bac3a20f7725f587173d3ec055c435 /lib/sqlalchemy
parent3ab7149e259124ce47121710b312a4c058d883e5 (diff)
downloadsqlalchemy-2269bee87fe905d2b6f608fa32cf1d35b6e7646f.tar.gz
- Determine the basic collection interface dynamically when adapting a collection to an interable
Diffstat (limited to 'lib/sqlalchemy')
-rw-r--r--lib/sqlalchemy/orm/collections.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py
index f2b726b4c..5f701bccc 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -504,11 +504,13 @@ class CollectionAdapter(object):
return converter(obj)
setting_type = sautil.duck_type_collection(obj)
+ receiving_type = sautil.duck_type_collection(self._data())
- if obj is None or setting_type != self.attr.collection_interface:
+ if obj is None or setting_type != receiving_type:
raise TypeError(
"Incompatible collection type: %s is not %s-like" %
- (type(obj).__name__, self.attr.collection_interface.__name__))
+ (type(obj).__class__.__name__,
+ receiving_type.__class__.__name__))
# If the object is an adapted collection, return the (iterable) adapter.
if getattr(obj, '_sa_adapter', None) is not None: