Moved proxy dict listener to global scope
This commit is contained in:
@@ -4,6 +4,12 @@ Changelog
|
||||
Here you can see the full list of changes between each SQLAlchemy-Utils release.
|
||||
|
||||
|
||||
0.12.3 (2013-05-30)
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- Proxy dict expiration listener from function scope to global scope
|
||||
|
||||
|
||||
0.12.2 (2013-05-29)
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
|
2
setup.py
2
setup.py
@@ -24,7 +24,7 @@ class PyTest(Command):
|
||||
|
||||
setup(
|
||||
name='SQLAlchemy-Utils',
|
||||
version='0.12.2',
|
||||
version='0.12.3',
|
||||
url='https://github.com/kvesteri/sqlalchemy-utils',
|
||||
license='BSD',
|
||||
author='Konsta Vesterinen',
|
||||
|
@@ -59,10 +59,6 @@ def proxy_dict(parent, collection_name, mapping_attr):
|
||||
try:
|
||||
parent._proxy_dicts
|
||||
except AttributeError:
|
||||
def expire_proxy_dicts(target, context):
|
||||
target._proxy_dicts = {}
|
||||
|
||||
sa.event.listen(parent.__class__, 'expire', expire_proxy_dicts)
|
||||
parent._proxy_dicts = {}
|
||||
|
||||
try:
|
||||
@@ -74,3 +70,11 @@ def proxy_dict(parent, collection_name, mapping_attr):
|
||||
mapping_attr
|
||||
)
|
||||
return parent._proxy_dicts[collection_name]
|
||||
|
||||
|
||||
def expire_proxy_dicts(target, context):
|
||||
if hasattr(target, '_proxy_dicts'):
|
||||
target._proxy_dicts = {}
|
||||
|
||||
|
||||
sa.event.listen(sa.orm.mapper, 'expire', expire_proxy_dicts)
|
||||
|
Reference in New Issue
Block a user