summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/ext/assignmapper.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/ext/assignmapper.py')
-rw-r--r--lib/sqlalchemy/ext/assignmapper.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/assignmapper.py b/lib/sqlalchemy/ext/assignmapper.py
index 8e06c5fb0..b7d5411b6 100644
--- a/lib/sqlalchemy/ext/assignmapper.py
+++ b/lib/sqlalchemy/ext/assignmapper.py
@@ -5,7 +5,10 @@ def monkeypatch_query_method(ctx, class_, name):
def do(self, *args, **kwargs):
query = Query(class_, session=ctx.current)
return getattr(query, name)(*args, **kwargs)
- do.__name__ = name
+ try:
+ do.__name__ = name
+ except:
+ pass
setattr(class_, name, classmethod(do))
def monkeypatch_objectstore_method(ctx, class_, name):
@@ -15,7 +18,10 @@ def monkeypatch_objectstore_method(ctx, class_, name):
# flush expects a list of objects
self = [self]
return getattr(session, name)(self, *args, **kwargs)
- do.__name__ = name
+ try:
+ do.__name__ = name
+ except:
+ pass
setattr(class_, name, do)
def assign_mapper(ctx, class_, *args, **kwargs):