Corrected the __repr__() value of Connections to include the actual

module name instead of a hard-coded "oracledb".
This commit is contained in:
Anthony Tuininga 2022-11-19 10:35:59 -07:00
parent 18ae81a9ff
commit 5e2334784e
3 changed files with 11 additions and 3 deletions

View File

@ -16,6 +16,12 @@ Thick Mode Changes
#) Fixed bug creating a homogeneous connection pool with a proxy user
(`issue 101 <https://github.com/oracle/python-oracledb/issues/101>`__).
Common Changes
++++++++++++++
#) Corrected ``__repr__()`` of connections to include the actual class name
instead of a hard-coded ``oracledb``.
oracledb 1.2.0 (November 2022)
------------------------------

View File

@ -159,7 +159,8 @@ class Connection:
self.close()
def __repr__(self):
cls_name = f"oracledb.{type(self).__name__}"
typ = type(self)
cls_name = f"{typ.__module__}.{typ.__qualname__}"
if self._impl is None:
return f"<{cls_name} disconnected>"
elif self.username is None:

View File

@ -157,7 +157,8 @@ class Connection:
self.close()
def __repr__(self):
cls_name = f"oracledb.{type(self).__name__}"
typ = type(self)
cls_name = f"{typ.__module__}.{typ.__qualname__}"
if self._impl is None:
return f"<{cls_name} disconnected>"
elif self.username is None:
@ -435,7 +436,7 @@ class Connection:
objects which can be bound to cursors created by this connection.
"""
self._verify_connected()
obj_type_impl = self._impl.get_type(name)
obj_type_impl = self._impl.get_type(self, name)
return DbObjectType._from_impl(obj_type_impl)
@property