diff options
author | Diana Clarke <diana.joan.clarke@gmail.com> | 2012-11-19 17:19:24 -0500 |
---|---|---|
committer | Diana Clarke <diana.joan.clarke@gmail.com> | 2012-11-19 17:19:24 -0500 |
commit | aba75454d064b157b546dbc379043f58c83a2b6d (patch) | |
tree | 9921c6114bcccca3b72c50b150f42d3ae6f2c76d /lib/sqlalchemy/orm/scoping.py | |
parent | dc81c91882a24e12679ff978aeb10be8b651a582 (diff) | |
download | sqlalchemy-aba75454d064b157b546dbc379043f58c83a2b6d.tar.gz |
just a pep8 pass of lib/sqlalchemy/orm/
Diffstat (limited to 'lib/sqlalchemy/orm/scoping.py')
-rw-r--r-- | lib/sqlalchemy/orm/scoping.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/sqlalchemy/orm/scoping.py b/lib/sqlalchemy/orm/scoping.py index 3c4a0e5d8..e0ee62012 100644 --- a/lib/sqlalchemy/orm/scoping.py +++ b/lib/sqlalchemy/orm/scoping.py @@ -87,7 +87,8 @@ class scoped_session(object): self.registry.clear() def configure(self, **kwargs): - """reconfigure the :class:`.sessionmaker` used by this :class:`.scoped_session`. + """reconfigure the :class:`.sessionmaker` used by this + :class:`.scoped_session`. See :meth:`.sessionmaker.configure`. @@ -142,27 +143,34 @@ class scoped_session(object): ScopedSession = scoped_session """Old name for backwards compatibility.""" + def instrument(name): def do(self, *args, **kwargs): return getattr(self.registry(), name)(*args, **kwargs) return do + for meth in Session.public_methods: setattr(scoped_session, meth, instrument(meth)) + def makeprop(name): def set(self, attr): setattr(self.registry(), name, attr) + def get(self): return getattr(self.registry(), name) + return property(get, set) + for prop in ('bind', 'dirty', 'deleted', 'new', 'identity_map', - 'is_active', 'autoflush', 'no_autoflush'): + 'is_active', 'autoflush', 'no_autoflush'): setattr(scoped_session, prop, makeprop(prop)) + def clslevel(name): def do(cls, *args, **kwargs): return getattr(Session, name)(*args, **kwargs) return classmethod(do) + for prop in ('close_all', 'object_session', 'identity_key'): setattr(scoped_session, prop, clslevel(prop)) - |