Skip to content

Commit 5e23347

Browse files
Corrected the __repr__() value of Connections to include the actual
module name instead of a hard-coded "oracledb".
1 parent 18ae81a commit 5e23347

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

doc/src/release_notes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Thick Mode Changes
1616
#) Fixed bug creating a homogeneous connection pool with a proxy user
1717
(`issue 101 <https://github.com/oracle/python-oracledb/issues/101>`__).
1818

19+
Common Changes
20+
++++++++++++++
21+
22+
#) Corrected ``__repr__()`` of connections to include the actual class name
23+
instead of a hard-coded ``oracledb``.
24+
1925

2026
oracledb 1.2.0 (November 2022)
2127
------------------------------

src/oracledb/connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@ def __exit__(self, exc_type, exc_value, exc_tb):
159159
self.close()
160160

161161
def __repr__(self):
162-
cls_name = f"oracledb.{type(self).__name__}"
162+
typ = type(self)
163+
cls_name = f"{typ.__module__}.{typ.__qualname__}"
163164
if self._impl is None:
164165
return f"<{cls_name} disconnected>"
165166
elif self.username is None:

utils/templates/connection.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ def __exit__(self, exc_type, exc_value, exc_tb):
157157
self.close()
158158

159159
def __repr__(self):
160-
cls_name = f"oracledb.{type(self).__name__}"
160+
typ = type(self)
161+
cls_name = f"{typ.__module__}.{typ.__qualname__}"
161162
if self._impl is None:
162163
return f"<{cls_name} disconnected>"
163164
elif self.username is None:
@@ -435,7 +436,7 @@ def gettype(self, name: str) -> DbObjectType:
435436
objects which can be bound to cursors created by this connection.
436437
"""
437438
self._verify_connected()
438-
obj_type_impl = self._impl.get_type(name)
439+
obj_type_impl = self._impl.get_type(self, name)
439440
return DbObjectType._from_impl(obj_type_impl)
440441

441442
@property

0 commit comments

Comments
 (0)