Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Monkey patches, ook
def _ex_cursor(self, name=None):
if self._stale_error is not None:
raise self._stale_error
with self._lock:
self._before_load()
return self._load_conn.cursor(name)
relstorage.storage.RelStorage.ex_cursor = _ex_cursor
def _ex_connect(self):
return self._adapter.connmanager.open()
relstorage.storage.RelStorage.ex_connect = _ex_connect
def _ex_get(self, oid, ghost_pickle):
"""Return the persistent object with oid 'oid'."""
if self.opened is None:
raise ConnectionStateError("The database connection is closed")
obj = self._cache.get(oid, None)
if obj is not None:
return obj
obj = self._added.get(oid, None)
if obj is not None:
return obj
obj = self._pre_cache.get(oid, None)
if obj is not None:
return obj