summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/associationproxy.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2008-05-05 21:33:29 +0000
committerJason Kirtland <jek@discorporate.us>2008-05-05 21:33:29 +0000
commit586e5be1bb2bedb69802312925ca84f81199f2ff (patch)
tree5a7376820c871dc1a2b6c51f7df847ddab7b3187 /lib/sqlalchemy/ext/associationproxy.py
parenta566964ac8a0f08d6dbbb2f541c805d828428411 (diff)
downloadsqlalchemy-586e5be1bb2bedb69802312925ca84f81199f2ff.tar.gz
Adjusted inplace-binops on set-based collections and association proxies to
more closely follow builtin (2.4+) set semantics. Formerly any set duck-type was accepted, now only types or subtypes of set, frozenset or the collection type itself are accepted.
Diffstat (limited to 'lib/sqlalchemy/ext/associationproxy.py')
-rw-r--r--lib/sqlalchemy/ext/associationproxy.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/sqlalchemy/ext/associationproxy.py b/lib/sqlalchemy/ext/associationproxy.py
index bcbfb4780..d878f7b9b 100644
--- a/lib/sqlalchemy/ext/associationproxy.py
+++ b/lib/sqlalchemy/ext/associationproxy.py
@@ -6,10 +6,12 @@ transparent proxied access to the endpoint of an association object.
See the example ``examples/association/proxied_association.py``.
"""
-import weakref, itertools
-import sqlalchemy.exceptions as exceptions
-import sqlalchemy.orm as orm
-import sqlalchemy.util as util
+import itertools
+import weakref
+from sqlalchemy import exceptions
+from sqlalchemy import orm
+from sqlalchemy import util
+from sqlalchemy.orm import collections
def association_proxy(targetcollection, attr, **kw):
@@ -702,7 +704,7 @@ class _AssociationSet(object):
self.add(value)
def __ior__(self, other):
- if util.duck_type_collection(other) is not util.Set:
+ if not collections._set_binops_check_strict(self, other):
return NotImplemented
for value in other:
self.add(value)
@@ -726,7 +728,7 @@ class _AssociationSet(object):
self.discard(value)
def __isub__(self, other):
- if util.duck_type_collection(other) is not util.Set:
+ if not collections._set_binops_check_strict(self, other):
return NotImplemented
for value in other:
self.discard(value)
@@ -748,7 +750,7 @@ class _AssociationSet(object):
self.add(value)
def __iand__(self, other):
- if util.duck_type_collection(other) is not util.Set:
+ if not collections._set_binops_check_strict(self, other):
return NotImplemented
want, have = self.intersection(other), util.Set(self)
@@ -776,7 +778,7 @@ class _AssociationSet(object):
self.add(value)
def __ixor__(self, other):
- if util.duck_type_collection(other) is not util.Set:
+ if not collections._set_binops_check_strict(self, other):
return NotImplemented
want, have = self.symmetric_difference(other), util.Set(self)