From: Douglas Bagnall Date: Mon, 19 Aug 2024 00:19:22 +0000 (+1200) Subject: ldb:py bindings: ldb.Ldb().__str__ prints connection URL X-Git-Tag: tdb-1.4.13~1179 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=64e3c5cba965fa8b0625a7165b98610418518818;p=thirdparty%2Fsamba.git ldb:py bindings: ldb.Ldb().__str__ prints connection URL before: "" after: "" Signed-off-by: Douglas Bagnall Reviewed-by: Andreas Schneider --- diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 53b855990bb..bf433288206 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -1342,7 +1342,12 @@ static PyObject *py_ldb_setup_wellknown_attributes(PyLdbObject *self, static PyObject *py_ldb_repr(PyLdbObject *self) { - return PyUnicode_FromString(""); + struct ldb_context *ldb_ctx = pyldb_Ldb_AS_LDBCONTEXT(self); + const char *url = ldb_get_opaque(ldb_ctx, "ldb_url"); + if (url == NULL) { + url = "no connection"; + } + return PyUnicode_FromFormat("", url); } static PyObject *py_ldb_get_root_basedn(PyLdbObject *self,