From 8d26c0111122c482149d0bad62c64ec1eb619d91 Mon Sep 17 00:00:00 2001 From: awais qureshi Date: Mon, 29 Apr 2024 00:22:21 +0500 Subject: [PATCH 1/2] feat: Adding python 3.11 support. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7af566a..f092c80 100644 --- a/setup.py +++ b/setup.py @@ -60,7 +60,7 @@ def is_requirement(line): setup( name='openedx-mongodbproxy', py_modules=['mongodb_proxy'], - version='0.2.0', + version='0.2.1', description='Proxy around MongoDB connection that automatically handles AutoReconnect exceptions.', author='Gustav Arngarden', long_description=LONG_DESCRIPTION, From 2519dbea27c8a22a45c869bbf9b1db3016ca7e26 Mon Sep 17 00:00:00 2001 From: awais qureshi Date: Mon, 29 Apr 2024 00:24:16 +0500 Subject: [PATCH 2/2] feat: Adding python 3.11 support. --- mongodb_proxy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mongodb_proxy.py b/mongodb_proxy.py index e737511..3b9efde 100644 --- a/mongodb_proxy.py +++ b/mongodb_proxy.py @@ -83,7 +83,7 @@ def __getitem__(self, key): Otherwise just return the attribute. """ item = self.proxied_object[key] - if hasattr(item, '__call__'): + if hasattr(item, '__call__') or attr.__class__.__name__ in ['Database']: return MongoProxy(item, self.wait_time) return item @@ -103,7 +103,7 @@ def __getattr__(self, key): that handles AutoReconnect exceptions. Otherwise wrap it in a MongoProxy object. """ attr = getattr(self.proxied_object, key) - if hasattr(attr, '__call__'): + if hasattr(attr, '__call__') or attr.__class__.__name__ in ['Database']: attributes_for_class = self.methods_needing_retry.get(self.proxied_object.__class__, []) if key in attributes_for_class: return autoretry_read(self.wait_time)(attr)