summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb.i
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-24 11:02:45 -0600
committerStefan Metzmacher <metze@samba.org>2007-12-26 11:57:03 -0600
commita822a14d1ec7e2635c3d004cc7488e4fd27b8d16 (patch)
tree50818c805dfbf204941c3d7b9bc8ec5482ee472e /source4/lib/ldb/ldb.i
parent9faf93c7b0e00edcdc3f535ea69fc2c1bb6eeeb3 (diff)
downloadsamba-a822a14d1ec7e2635c3d004cc7488e4fd27b8d16.tar.gz
samba-a822a14d1ec7e2635c3d004cc7488e4fd27b8d16.tar.bz2
samba-a822a14d1ec7e2635c3d004cc7488e4fd27b8d16.zip
r26584: Fix exception handling in ldb constructor.
(This used to be commit 5383cf8e69233b3cb7c1876f52644537e459dea6)
Diffstat (limited to 'source4/lib/ldb/ldb.i')
-rw-r--r--source4/lib/ldb/ldb.i27
1 files changed, 8 insertions, 19 deletions
diff --git a/source4/lib/ldb/ldb.i b/source4/lib/ldb/ldb.i
index ffb69986e5..7960d38bb5 100644
--- a/source4/lib/ldb/ldb.i
+++ b/source4/lib/ldb/ldb.i
@@ -463,25 +463,7 @@ PyObject *PyExc_LdbError;
/* Top-level ldb operations */
typedef struct ldb_context {
%extend {
- ldb(const char *url=NULL, unsigned int flags = 0,
- const char *options[] = NULL)
- {
- ldb *ldb_ctx = ldb_init(NULL);
-
- if (url != NULL) {
- int ret;
-
- ret = ldb_connect(ldb_ctx, url, flags, options);
- if (ret != LDB_SUCCESS)
- SWIG_exception(SWIG_ValueError, ldb_errstring(ldb_ctx));
- }
-
- return ldb_ctx;
-
-fail:
- talloc_free(ldb_ctx);
- return NULL;
- }
+ ldb(void) { return ldb_init(NULL); }
ldb_error connect(const char *url, unsigned int flags = 0,
const char *options[] = NULL);
@@ -576,6 +558,13 @@ fail:
#endif
}
+ %pythoncode {
+ def __init__(self, url=None, flags=0, options=None):
+ _ldb.Ldb_swiginit(self,_ldb.new_Ldb())
+ if url is not None:
+ self.connect(url, flags, options)
+ }
+
} ldb;
%typemap(in,noblock=1) struct ldb_dn *;