From 8967f96fd856cb7a16c21caf106c62aaead0d79c Mon Sep 17 00:00:00 2001 From: awais qureshi Date: Mon, 29 Apr 2024 00:22:21 +0500 Subject: [PATCH] feat: Adding python 3.11 support. --- mongodb_proxy.py | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mongodb_proxy.py b/mongodb_proxy.py index e737511..b784300 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 isinstance(item, pymongo.database.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 isinstance(attr, pymongo.database.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) 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,