diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-04-25 01:04:52 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2007-04-25 01:04:52 +0000 |
commit | 91e449800aff0d324b0b23add0415839e81fac5a (patch) | |
tree | 6ce2214ce87f8a61a030f063c3ea47a09dc74cc7 /lib/sqlalchemy/ext/assignmapper.py | |
parent | 6124ef228586ac2db4d0a0f8d1ec159ccccfa83f (diff) | |
download | sqlalchemy-91e449800aff0d324b0b23add0415839e81fac5a.tar.gz |
wrap __name__ settings in a try/except for 2.3 compat
Diffstat (limited to 'lib/sqlalchemy/ext/assignmapper.py')
-rw-r--r-- | lib/sqlalchemy/ext/assignmapper.py | 10 |
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): |