return ldb_dn_add_base(dn, other)?Py_True:Py_False;
}
+static PyObject *py_ldb_dn_remove_base_components(PyLdbDnObject *self, PyObject *args)
+{
+ struct ldb_dn *dn;
+ int i;
+ if (!PyArg_ParseTuple(args, "i", &i))
+ return NULL;
+
+ dn = pyldb_Dn_AsDn((PyObject *)self);
+
+ return ldb_dn_remove_base_components(dn, i)?Py_True:Py_False;
+}
+
static PyObject *py_ldb_dn_is_child_of(PyLdbDnObject *self, PyObject *args)
{
PyObject *py_base;
{ "add_base", (PyCFunction)py_ldb_dn_add_base, METH_VARARGS,
"S.add_base(dn) -> None\n"
"Add a base DN to this DN." },
+ { "remove_base_components", (PyCFunction)py_ldb_dn_remove_base_components, METH_VARARGS,
+ "S.remove_base_components(int) -> bool\n"
+ "Remove a number of DN components from the base of this DN." },
{ "check_special", (PyCFunction)py_ldb_dn_check_special, METH_VARARGS,
"S.check_special(name) -> bool\n\n"
"Check if name is a special DN name"},
y = ldb.Dn(self.ldb, "bar=bla")
self.assertEquals("dc=foo24,bar=bla", str(x + y))
+ def test_remove_base_components(self):
+ x = ldb.Dn(self.ldb, "dc=foo24,dc=samba,dc=org")
+ x.remove_base_components(len(x)-1)
+ self.assertEquals("dc=foo24", str(x))
+
def test_parse_ldif(self):
msgs = self.ldb.parse_ldif("dn: foo=bar\n")
msg = msgs.next()