Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions neo4j/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,6 @@ def __del__(self):
except OSError:
pass

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
self.close()

def route(self, database=None, bookmarks=None):
""" Fetch a routing table from the server for the given
`database`. For Bolt 4.3 and above, this appends a ROUTE
Expand Down Expand Up @@ -675,10 +669,13 @@ def fetch_routing_info(self, address, database, bookmarks, timeout):
routing, or if routing support is broken or outdated
"""
try:
with self._acquire(address, timeout) as cx:
cx = self._acquire(address, timeout)
try:
routing_table = cx.route(
database or self.workspace_config.database, bookmarks
)
finally:
self.release(cx)
except BoltRoutingError as error:
# Connection was successful, but routing support is
# broken. This may indicate that the routing procedure
Expand Down