mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
Remove remaining fragments of SWIG code in pyldb.
This commit is contained in:
parent
eeb25cf548
commit
33ebc95591
@ -1981,94 +1981,3 @@ void initldb(void)
|
||||
PyModule_AddObject(m, "Module", (PyObject *)&PyLdbModule);
|
||||
PyModule_AddObject(m, "Tree", (PyObject *)&PyLdbTree);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* ldb_message_element */
|
||||
%rename(MessageElement) ldb_message_element;
|
||||
%feature("docstring") ldb_message_element "Message element.";
|
||||
typedef struct ldb_message_element {
|
||||
%extend {
|
||||
PyObject *__set__(void)
|
||||
{
|
||||
return ldb_msg_element_to_set(NULL, $self);
|
||||
}
|
||||
|
||||
ldb_message_element(PyObject *set_obj, int flags=0, const char *name = NULL)
|
||||
{
|
||||
return PyObject_AsMessageElement(NULL, set_obj, flags, name);
|
||||
}
|
||||
|
||||
}
|
||||
%pythoncode {
|
||||
def __getitem__(self, i):
|
||||
ret = self.get(i)
|
||||
if ret is None:
|
||||
raise KeyError("no such value")
|
||||
return ret
|
||||
|
||||
def __repr__(self):
|
||||
return "MessageElement([%s])" % (",".join(repr(x) for x in self.__set__()))
|
||||
}
|
||||
} ldb_message_element;
|
||||
|
||||
/* ldb_message */
|
||||
|
||||
typedef struct ldb_message {
|
||||
ldb_dn *dn;
|
||||
|
||||
%extend {
|
||||
ldb_msg(ldb_dn *dn = NULL) {
|
||||
ret->dn = talloc_reference(ret, dn);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void __setitem__(const char *attr_name, ldb_message_element *val)
|
||||
{
|
||||
struct ldb_message_element *el;
|
||||
|
||||
ldb_msg_remove_attr($self, attr_name);
|
||||
|
||||
el = talloc($self, struct ldb_message_element);
|
||||
el->name = talloc_strdup(el, attr_name);
|
||||
el->num_values = val->num_values;
|
||||
el->values = talloc_reference(el, val->values);
|
||||
|
||||
ldb_msg_add($self, el, val->flags);
|
||||
}
|
||||
|
||||
void __setitem__(const char *attr_name, PyObject *val)
|
||||
{
|
||||
}
|
||||
%pythoncode {
|
||||
def get(self, key, default=None):
|
||||
if key == "dn":
|
||||
return self.dn
|
||||
return self.find_element(key)
|
||||
|
||||
def iteritems(self):
|
||||
for k in self.keys():
|
||||
yield k, self[k]
|
||||
|
||||
def items(self):
|
||||
return list(self.iteritems())
|
||||
|
||||
def __repr__(self):
|
||||
return "Message(%s)" % repr(dict(self.iteritems()))
|
||||
}
|
||||
}
|
||||
} ldb_msg;
|
||||
|
||||
typedef struct ldb_context {
|
||||
%pythoncode {
|
||||
def itermodules(self):
|
||||
m = self.firstmodule
|
||||
while m is not None:
|
||||
yield m
|
||||
m = m.next
|
||||
|
||||
def modules(self):
|
||||
return list(self.itermodules())
|
||||
}
|
||||
} ldb;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user