From 53ae9bc9f6f66578948c3995073bdc1f1acae0f1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 13:48:09 +0100 Subject: r26248: Check in SWIG output so SWIG is not required when running out of svn. (This used to be commit 08501fbef38f81ce5ff4885a1696f9cb392fd631) --- source4/lib/ldb/ldb.py | 218 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 source4/lib/ldb/ldb.py (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py new file mode 100644 index 0000000000..b887b21aea --- /dev/null +++ b/source4/lib/ldb/ldb.py @@ -0,0 +1,218 @@ +# This file was automatically generated by SWIG (http://www.swig.org). +# Version 1.3.33 +# +# Don't modify this file, modify the SWIG interface instead. +# This file is compatible with both classic and new-style classes. + +import _ldb +import new +new_instancemethod = new.instancemethod +try: + _swig_property = property +except NameError: + pass # Python < 2.2 doesn't have 'property'. +def _swig_setattr_nondynamic(self,class_type,name,value,static=1): + if (name == "thisown"): return self.this.own(value) + if (name == "this"): + if type(value).__name__ == 'PySwigObject': + self.__dict__[name] = value + return + method = class_type.__swig_setmethods__.get(name,None) + if method: return method(self,value) + if (not static) or hasattr(self,name): + self.__dict__[name] = value + else: + raise AttributeError("You cannot add attributes to %s" % self) + +def _swig_setattr(self,class_type,name,value): + return _swig_setattr_nondynamic(self,class_type,name,value,0) + +def _swig_getattr(self,class_type,name): + if (name == "thisown"): return self.this.own() + method = class_type.__swig_getmethods__.get(name,None) + if method: return method(self) + raise AttributeError,name + +def _swig_repr(self): + try: strthis = "proxy of " + self.this.__repr__() + except: strthis = "" + return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) + +import types +try: + _object = types.ObjectType + _newclass = 1 +except AttributeError: + class _object : pass + _newclass = 0 +del types + + +SCOPE_DEFAULT = _ldb.SCOPE_DEFAULT +SCOPE_BASE = _ldb.SCOPE_BASE +SCOPE_ONELEVEL = _ldb.SCOPE_ONELEVEL +SCOPE_SUBTREE = _ldb.SCOPE_SUBTREE +CHANGETYPE_NONE = _ldb.CHANGETYPE_NONE +CHANGETYPE_ADD = _ldb.CHANGETYPE_ADD +CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE +CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY +class Dn(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Dn, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Dn, name) + __repr__ = _swig_repr + def __init__(self, *args, **kwargs): + this = _ldb.new_Dn(*args, **kwargs) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _ldb.delete_Dn + __del__ = lambda self : None; + def validate(*args, **kwargs): return _ldb.Dn_validate(*args, **kwargs) + def get_casefold(*args, **kwargs): return _ldb.Dn_get_casefold(*args, **kwargs) + def __str__(*args, **kwargs): return _ldb.Dn___str__(*args, **kwargs) + def parent(*args, **kwargs): return _ldb.Dn_parent(*args, **kwargs) + def __cmp__(*args, **kwargs): return _ldb.Dn___cmp__(*args, **kwargs) + def is_valid(*args, **kwargs): return _ldb.Dn_is_valid(*args, **kwargs) + def is_special(*args, **kwargs): return _ldb.Dn_is_special(*args, **kwargs) + def is_null(*args, **kwargs): return _ldb.Dn_is_null(*args, **kwargs) + def check_special(*args, **kwargs): return _ldb.Dn_check_special(*args, **kwargs) + def __len__(*args, **kwargs): return _ldb.Dn___len__(*args, **kwargs) + def add_child(*args, **kwargs): return _ldb.Dn_add_child(*args, **kwargs) + def add_base(*args, **kwargs): return _ldb.Dn_add_base(*args, **kwargs) + def canonical_str(*args, **kwargs): return _ldb.Dn_canonical_str(*args, **kwargs) + def canonical_ex_str(*args, **kwargs): return _ldb.Dn_canonical_ex_str(*args, **kwargs) + def __add__(*args, **kwargs): return _ldb.Dn___add__(*args, **kwargs) +Dn_swigregister = _ldb.Dn_swigregister +Dn_swigregister(Dn) + +ldb_dn_from_pyobject = _ldb.ldb_dn_from_pyobject +ldb_msg_element_from_pyobject = _ldb.ldb_msg_element_from_pyobject +ldb_msg_element_to_set = _ldb.ldb_msg_element_to_set +class ldb_msg_element(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, ldb_msg_element, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, ldb_msg_element, name) + def __init__(self): raise AttributeError, "No constructor defined" + __repr__ = _swig_repr + def __iter__(*args, **kwargs): return _ldb.ldb_msg_element___iter__(*args, **kwargs) + def __set__(*args, **kwargs): return _ldb.ldb_msg_element___set__(*args, **kwargs) + __swig_destroy__ = _ldb.delete_ldb_msg_element + __del__ = lambda self : None; + def __cmp__(*args, **kwargs): return _ldb.ldb_msg_element___cmp__(*args, **kwargs) +ldb_msg_element_swigregister = _ldb.ldb_msg_element_swigregister +ldb_msg_element_swigregister(ldb_msg_element) + +def MessageElement(*args, **kwargs): + val = _ldb.new_MessageElement(*args, **kwargs) + return val + +ldb_msg_list_elements = _ldb.ldb_msg_list_elements +class Message(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, Message, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, Message, name) + __repr__ = _swig_repr + __swig_setmethods__["dn"] = _ldb.Message_dn_set + __swig_getmethods__["dn"] = _ldb.Message_dn_get + if _newclass:dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set) + def __init__(self, *args, **kwargs): + this = _ldb.new_Message(*args, **kwargs) + try: self.this.append(this) + except: self.this = this + __swig_destroy__ = _ldb.delete_Message + __del__ = lambda self : None; + def __getitem__(*args, **kwargs): return _ldb.Message___getitem__(*args, **kwargs) + def __setitem__(*args): return _ldb.Message___setitem__(*args) + def __len__(*args, **kwargs): return _ldb.Message___len__(*args, **kwargs) + def keys(*args, **kwargs): return _ldb.Message_keys(*args, **kwargs) + def __iter__(*args, **kwargs): return _ldb.Message___iter__(*args, **kwargs) + def __delitem__(*args, **kwargs): return _ldb.Message___delitem__(*args, **kwargs) +Message_swigregister = _ldb.Message_swigregister +Message_swigregister(Message) + +ldb_ldif_to_pyobject = _ldb.ldb_ldif_to_pyobject +LdbError = _ldb.LdbError + +LDB_ERR_OPERATIONS_ERROR = _ldb.LDB_ERR_OPERATIONS_ERROR +LDB_ERR_PROTOCOL_ERROR = _ldb.LDB_ERR_PROTOCOL_ERROR +LDB_ERR_TIME_LIMIT_EXCEEDED = _ldb.LDB_ERR_TIME_LIMIT_EXCEEDED +LDB_ERR_SIZE_LIMIT_EXCEEDED = _ldb.LDB_ERR_SIZE_LIMIT_EXCEEDED +LDB_ERR_COMPARE_FALSE = _ldb.LDB_ERR_COMPARE_FALSE +LDB_ERR_COMPARE_TRUE = _ldb.LDB_ERR_COMPARE_TRUE +LDB_ERR_AUTH_METHOD_NOT_SUPPORTED = _ldb.LDB_ERR_AUTH_METHOD_NOT_SUPPORTED +LDB_ERR_STRONG_AUTH_REQUIRED = _ldb.LDB_ERR_STRONG_AUTH_REQUIRED +LDB_ERR_REFERRAL = _ldb.LDB_ERR_REFERRAL +LDB_ERR_ADMIN_LIMIT_EXCEEDED = _ldb.LDB_ERR_ADMIN_LIMIT_EXCEEDED +LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION = _ldb.LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION +LDB_ERR_CONFIDENTIALITY_REQUIRED = _ldb.LDB_ERR_CONFIDENTIALITY_REQUIRED +LDB_ERR_SASL_BIND_IN_PROGRESS = _ldb.LDB_ERR_SASL_BIND_IN_PROGRESS +LDB_ERR_NO_SUCH_ATTRIBUTE = _ldb.LDB_ERR_NO_SUCH_ATTRIBUTE +LDB_ERR_UNDEFINED_ATTRIBUTE_TYPE = _ldb.LDB_ERR_UNDEFINED_ATTRIBUTE_TYPE +LDB_ERR_INAPPROPRIATE_MATCHING = _ldb.LDB_ERR_INAPPROPRIATE_MATCHING +LDB_ERR_CONSTRAINT_VIOLATION = _ldb.LDB_ERR_CONSTRAINT_VIOLATION +LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS = _ldb.LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS +LDB_ERR_INVALID_ATTRIBUTE_SYNTAX = _ldb.LDB_ERR_INVALID_ATTRIBUTE_SYNTAX +LDB_ERR_NO_SUCH_OBJECT = _ldb.LDB_ERR_NO_SUCH_OBJECT +LDB_ERR_ALIAS_PROBLEM = _ldb.LDB_ERR_ALIAS_PROBLEM +LDB_ERR_INVALID_DN_SYNTAX = _ldb.LDB_ERR_INVALID_DN_SYNTAX +LDB_ERR_ALIAS_DEREFERENCING_PROBLEM = _ldb.LDB_ERR_ALIAS_DEREFERENCING_PROBLEM +LDB_ERR_INAPPROPRIATE_AUTHENTICATION = _ldb.LDB_ERR_INAPPROPRIATE_AUTHENTICATION +LDB_ERR_INVALID_CREDENTIALS = _ldb.LDB_ERR_INVALID_CREDENTIALS +LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS = _ldb.LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS +LDB_ERR_BUSY = _ldb.LDB_ERR_BUSY +LDB_ERR_UNAVAILABLE = _ldb.LDB_ERR_UNAVAILABLE +LDB_ERR_UNWILLING_TO_PERFORM = _ldb.LDB_ERR_UNWILLING_TO_PERFORM +LDB_ERR_LOOP_DETECT = _ldb.LDB_ERR_LOOP_DETECT +LDB_ERR_NAMING_VIOLATION = _ldb.LDB_ERR_NAMING_VIOLATION +LDB_ERR_OBJECT_CLASS_VIOLATION = _ldb.LDB_ERR_OBJECT_CLASS_VIOLATION +LDB_ERR_NOT_ALLOWED_ON_NON_LEAF = _ldb.LDB_ERR_NOT_ALLOWED_ON_NON_LEAF +LDB_ERR_NOT_ALLOWED_ON_RDN = _ldb.LDB_ERR_NOT_ALLOWED_ON_RDN +LDB_ERR_ENTRY_ALREADY_EXISTS = _ldb.LDB_ERR_ENTRY_ALREADY_EXISTS +LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED +LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS +LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER +class ldb(_object): + __swig_setmethods__ = {} + __setattr__ = lambda self, name, value: _swig_setattr(self, ldb, name, value) + __swig_getmethods__ = {} + __getattr__ = lambda self, name: _swig_getattr(self, ldb, name) + def __init__(self): raise AttributeError, "No constructor defined" + __repr__ = _swig_repr + def connect(*args, **kwargs): return _ldb.ldb_connect(*args, **kwargs) + __swig_destroy__ = _ldb.delete_ldb + __del__ = lambda self : None; + def search(*args, **kwargs): return _ldb.ldb_search(*args, **kwargs) + def delete(*args, **kwargs): return _ldb.ldb_delete(*args, **kwargs) + def rename(*args, **kwargs): return _ldb.ldb_rename(*args, **kwargs) + def add(*args, **kwargs): return _ldb.ldb_add(*args, **kwargs) + def modify(*args, **kwargs): return _ldb.ldb_modify(*args, **kwargs) + def get_config_basedn(*args, **kwargs): return _ldb.ldb_get_config_basedn(*args, **kwargs) + def get_root_basedn(*args, **kwargs): return _ldb.ldb_get_root_basedn(*args, **kwargs) + def get_schema_basedn(*args, **kwargs): return _ldb.ldb_get_schema_basedn(*args, **kwargs) + def get_default_basedn(*args, **kwargs): return _ldb.ldb_get_default_basedn(*args, **kwargs) + def errstring(*args, **kwargs): return _ldb.ldb_errstring(*args, **kwargs) + def set_create_perms(*args, **kwargs): return _ldb.ldb_set_create_perms(*args, **kwargs) + def set_modules_dir(*args, **kwargs): return _ldb.ldb_set_modules_dir(*args, **kwargs) + def set_debug(*args, **kwargs): return _ldb.ldb_set_debug(*args, **kwargs) + def set_opaque(*args, **kwargs): return _ldb.ldb_set_opaque(*args, **kwargs) + def get_opaque(*args, **kwargs): return _ldb.ldb_get_opaque(*args, **kwargs) + def transaction_start(*args, **kwargs): return _ldb.ldb_transaction_start(*args, **kwargs) + def transaction_commit(*args, **kwargs): return _ldb.ldb_transaction_commit(*args, **kwargs) + def transaction_cancel(*args, **kwargs): return _ldb.ldb_transaction_cancel(*args, **kwargs) + def __contains__(*args, **kwargs): return _ldb.ldb___contains__(*args, **kwargs) + def parse_ldif(*args, **kwargs): return _ldb.ldb_parse_ldif(*args, **kwargs) +ldb_swigregister = _ldb.ldb_swigregister +ldb_swigregister(ldb) + +def Ldb(*args, **kwargs): + val = _ldb.new_Ldb(*args, **kwargs) + return val + +valid_attr_name = _ldb.valid_attr_name +timestring = _ldb.timestring +string_to_time = _ldb.string_to_time + + -- cgit From 68dc2dc526e146dd0ac68d5d68eb55b601282caf Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 11 Dec 2007 14:31:01 +0100 Subject: r26399: Use -O option for SWIG (less evil generated code). (This used to be commit 3378b6a559272cb702b52966692bf423f67a2b41) --- source4/lib/ldb/ldb.py | 145 ++++++++++++++++++++++--------------------------- 1 file changed, 66 insertions(+), 79 deletions(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index b887b21aea..d9ddb8af0a 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -2,7 +2,6 @@ # Version 1.3.33 # # Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. import _ldb import new @@ -48,6 +47,16 @@ except AttributeError: del types +def _swig_setattr_nondynamic_method(set): + def set_attr(self,name,value): + if (name == "thisown"): return self.this.own(value) + if hasattr(self,name) or (name == "this"): + set(self,name,value) + else: + raise AttributeError("You cannot add attributes to %s" % self) + return set_attr + + SCOPE_DEFAULT = _ldb.SCOPE_DEFAULT SCOPE_BASE = _ldb.SCOPE_BASE SCOPE_ONELEVEL = _ldb.SCOPE_ONELEVEL @@ -56,51 +65,41 @@ CHANGETYPE_NONE = _ldb.CHANGETYPE_NONE CHANGETYPE_ADD = _ldb.CHANGETYPE_ADD CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY -class Dn(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, Dn, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, Dn, name) +class Dn(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): - this = _ldb.new_Dn(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn - __del__ = lambda self : None; - def validate(*args, **kwargs): return _ldb.Dn_validate(*args, **kwargs) - def get_casefold(*args, **kwargs): return _ldb.Dn_get_casefold(*args, **kwargs) - def __str__(*args, **kwargs): return _ldb.Dn___str__(*args, **kwargs) - def parent(*args, **kwargs): return _ldb.Dn_parent(*args, **kwargs) - def __cmp__(*args, **kwargs): return _ldb.Dn___cmp__(*args, **kwargs) - def is_valid(*args, **kwargs): return _ldb.Dn_is_valid(*args, **kwargs) - def is_special(*args, **kwargs): return _ldb.Dn_is_special(*args, **kwargs) - def is_null(*args, **kwargs): return _ldb.Dn_is_null(*args, **kwargs) - def check_special(*args, **kwargs): return _ldb.Dn_check_special(*args, **kwargs) - def __len__(*args, **kwargs): return _ldb.Dn___len__(*args, **kwargs) - def add_child(*args, **kwargs): return _ldb.Dn_add_child(*args, **kwargs) - def add_base(*args, **kwargs): return _ldb.Dn_add_base(*args, **kwargs) - def canonical_str(*args, **kwargs): return _ldb.Dn_canonical_str(*args, **kwargs) - def canonical_ex_str(*args, **kwargs): return _ldb.Dn_canonical_ex_str(*args, **kwargs) - def __add__(*args, **kwargs): return _ldb.Dn___add__(*args, **kwargs) +Dn.validate = new_instancemethod(_ldb.Dn_validate,None,Dn) +Dn.get_casefold = new_instancemethod(_ldb.Dn_get_casefold,None,Dn) +Dn.__str__ = new_instancemethod(_ldb.Dn___str__,None,Dn) +Dn.parent = new_instancemethod(_ldb.Dn_parent,None,Dn) +Dn.__cmp__ = new_instancemethod(_ldb.Dn___cmp__,None,Dn) +Dn.is_valid = new_instancemethod(_ldb.Dn_is_valid,None,Dn) +Dn.is_special = new_instancemethod(_ldb.Dn_is_special,None,Dn) +Dn.is_null = new_instancemethod(_ldb.Dn_is_null,None,Dn) +Dn.check_special = new_instancemethod(_ldb.Dn_check_special,None,Dn) +Dn.__len__ = new_instancemethod(_ldb.Dn___len__,None,Dn) +Dn.add_child = new_instancemethod(_ldb.Dn_add_child,None,Dn) +Dn.add_base = new_instancemethod(_ldb.Dn_add_base,None,Dn) +Dn.canonical_str = new_instancemethod(_ldb.Dn_canonical_str,None,Dn) +Dn.canonical_ex_str = new_instancemethod(_ldb.Dn_canonical_ex_str,None,Dn) +Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn) Dn_swigregister = _ldb.Dn_swigregister Dn_swigregister(Dn) ldb_dn_from_pyobject = _ldb.ldb_dn_from_pyobject ldb_msg_element_from_pyobject = _ldb.ldb_msg_element_from_pyobject ldb_msg_element_to_set = _ldb.ldb_msg_element_to_set -class ldb_msg_element(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, ldb_msg_element, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, ldb_msg_element, name) +class ldb_msg_element(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self): raise AttributeError, "No constructor defined" __repr__ = _swig_repr - def __iter__(*args, **kwargs): return _ldb.ldb_msg_element___iter__(*args, **kwargs) - def __set__(*args, **kwargs): return _ldb.ldb_msg_element___set__(*args, **kwargs) __swig_destroy__ = _ldb.delete_ldb_msg_element - __del__ = lambda self : None; - def __cmp__(*args, **kwargs): return _ldb.ldb_msg_element___cmp__(*args, **kwargs) +ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element) +ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element) +ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element) ldb_msg_element_swigregister = _ldb.ldb_msg_element_swigregister ldb_msg_element_swigregister(ldb_msg_element) @@ -109,27 +108,19 @@ def MessageElement(*args, **kwargs): return val ldb_msg_list_elements = _ldb.ldb_msg_list_elements -class Message(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, Message, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, Message, name) +class Message(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_setmethods__["dn"] = _ldb.Message_dn_set - __swig_getmethods__["dn"] = _ldb.Message_dn_get - if _newclass:dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set) + dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set) def __init__(self, *args, **kwargs): - this = _ldb.new_Message(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _ldb.Message_swiginit(self,_ldb.new_Message(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Message - __del__ = lambda self : None; - def __getitem__(*args, **kwargs): return _ldb.Message___getitem__(*args, **kwargs) - def __setitem__(*args): return _ldb.Message___setitem__(*args) - def __len__(*args, **kwargs): return _ldb.Message___len__(*args, **kwargs) - def keys(*args, **kwargs): return _ldb.Message_keys(*args, **kwargs) - def __iter__(*args, **kwargs): return _ldb.Message___iter__(*args, **kwargs) - def __delitem__(*args, **kwargs): return _ldb.Message___delitem__(*args, **kwargs) +Message.__getitem__ = new_instancemethod(_ldb.Message___getitem__,None,Message) +Message.__setitem__ = new_instancemethod(_ldb.Message___setitem__,None,Message) +Message.__len__ = new_instancemethod(_ldb.Message___len__,None,Message) +Message.keys = new_instancemethod(_ldb.Message_keys,None,Message) +Message.__iter__ = new_instancemethod(_ldb.Message___iter__,None,Message) +Message.__delitem__ = new_instancemethod(_ldb.Message___delitem__,None,Message) Message_swigregister = _ldb.Message_swigregister Message_swigregister(Message) @@ -174,36 +165,32 @@ LDB_ERR_ENTRY_ALREADY_EXISTS = _ldb.LDB_ERR_ENTRY_ALREADY_EXISTS LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER -class ldb(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, ldb, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, ldb, name) +class ldb(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self): raise AttributeError, "No constructor defined" __repr__ = _swig_repr - def connect(*args, **kwargs): return _ldb.ldb_connect(*args, **kwargs) __swig_destroy__ = _ldb.delete_ldb - __del__ = lambda self : None; - def search(*args, **kwargs): return _ldb.ldb_search(*args, **kwargs) - def delete(*args, **kwargs): return _ldb.ldb_delete(*args, **kwargs) - def rename(*args, **kwargs): return _ldb.ldb_rename(*args, **kwargs) - def add(*args, **kwargs): return _ldb.ldb_add(*args, **kwargs) - def modify(*args, **kwargs): return _ldb.ldb_modify(*args, **kwargs) - def get_config_basedn(*args, **kwargs): return _ldb.ldb_get_config_basedn(*args, **kwargs) - def get_root_basedn(*args, **kwargs): return _ldb.ldb_get_root_basedn(*args, **kwargs) - def get_schema_basedn(*args, **kwargs): return _ldb.ldb_get_schema_basedn(*args, **kwargs) - def get_default_basedn(*args, **kwargs): return _ldb.ldb_get_default_basedn(*args, **kwargs) - def errstring(*args, **kwargs): return _ldb.ldb_errstring(*args, **kwargs) - def set_create_perms(*args, **kwargs): return _ldb.ldb_set_create_perms(*args, **kwargs) - def set_modules_dir(*args, **kwargs): return _ldb.ldb_set_modules_dir(*args, **kwargs) - def set_debug(*args, **kwargs): return _ldb.ldb_set_debug(*args, **kwargs) - def set_opaque(*args, **kwargs): return _ldb.ldb_set_opaque(*args, **kwargs) - def get_opaque(*args, **kwargs): return _ldb.ldb_get_opaque(*args, **kwargs) - def transaction_start(*args, **kwargs): return _ldb.ldb_transaction_start(*args, **kwargs) - def transaction_commit(*args, **kwargs): return _ldb.ldb_transaction_commit(*args, **kwargs) - def transaction_cancel(*args, **kwargs): return _ldb.ldb_transaction_cancel(*args, **kwargs) - def __contains__(*args, **kwargs): return _ldb.ldb___contains__(*args, **kwargs) - def parse_ldif(*args, **kwargs): return _ldb.ldb_parse_ldif(*args, **kwargs) +ldb.connect = new_instancemethod(_ldb.ldb_connect,None,ldb) +ldb.search = new_instancemethod(_ldb.ldb_search,None,ldb) +ldb.delete = new_instancemethod(_ldb.ldb_delete,None,ldb) +ldb.rename = new_instancemethod(_ldb.ldb_rename,None,ldb) +ldb.add = new_instancemethod(_ldb.ldb_add,None,ldb) +ldb.modify = new_instancemethod(_ldb.ldb_modify,None,ldb) +ldb.get_config_basedn = new_instancemethod(_ldb.ldb_get_config_basedn,None,ldb) +ldb.get_root_basedn = new_instancemethod(_ldb.ldb_get_root_basedn,None,ldb) +ldb.get_schema_basedn = new_instancemethod(_ldb.ldb_get_schema_basedn,None,ldb) +ldb.get_default_basedn = new_instancemethod(_ldb.ldb_get_default_basedn,None,ldb) +ldb.errstring = new_instancemethod(_ldb.ldb_errstring,None,ldb) +ldb.set_create_perms = new_instancemethod(_ldb.ldb_set_create_perms,None,ldb) +ldb.set_modules_dir = new_instancemethod(_ldb.ldb_set_modules_dir,None,ldb) +ldb.set_debug = new_instancemethod(_ldb.ldb_set_debug,None,ldb) +ldb.set_opaque = new_instancemethod(_ldb.ldb_set_opaque,None,ldb) +ldb.get_opaque = new_instancemethod(_ldb.ldb_get_opaque,None,ldb) +ldb.transaction_start = new_instancemethod(_ldb.ldb_transaction_start,None,ldb) +ldb.transaction_commit = new_instancemethod(_ldb.ldb_transaction_commit,None,ldb) +ldb.transaction_cancel = new_instancemethod(_ldb.ldb_transaction_cancel,None,ldb) +ldb.__contains__ = new_instancemethod(_ldb.ldb___contains__,None,ldb) +ldb.parse_ldif = new_instancemethod(_ldb.ldb_parse_ldif,None,ldb) ldb_swigregister = _ldb.ldb_swigregister ldb_swigregister(ldb) -- cgit From b0360e3a8617c59661d0b0fd805666e6cefcd811 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 17 Dec 2007 08:20:20 +0100 Subject: r26496: Move some provision functions to a new SamDB class, support setting session_info on a ldb context from python. (This used to be commit 75cfb0d609687538048a7d72a499a5205af46a34) --- source4/lib/ldb/ldb.py | 57 ++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 30 deletions(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index d9ddb8af0a..10f42b0f83 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -165,38 +165,35 @@ LDB_ERR_ENTRY_ALREADY_EXISTS = _ldb.LDB_ERR_ENTRY_ALREADY_EXISTS LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER -class ldb(object): +class Ldb(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - def __init__(self): raise AttributeError, "No constructor defined" __repr__ = _swig_repr - __swig_destroy__ = _ldb.delete_ldb -ldb.connect = new_instancemethod(_ldb.ldb_connect,None,ldb) -ldb.search = new_instancemethod(_ldb.ldb_search,None,ldb) -ldb.delete = new_instancemethod(_ldb.ldb_delete,None,ldb) -ldb.rename = new_instancemethod(_ldb.ldb_rename,None,ldb) -ldb.add = new_instancemethod(_ldb.ldb_add,None,ldb) -ldb.modify = new_instancemethod(_ldb.ldb_modify,None,ldb) -ldb.get_config_basedn = new_instancemethod(_ldb.ldb_get_config_basedn,None,ldb) -ldb.get_root_basedn = new_instancemethod(_ldb.ldb_get_root_basedn,None,ldb) -ldb.get_schema_basedn = new_instancemethod(_ldb.ldb_get_schema_basedn,None,ldb) -ldb.get_default_basedn = new_instancemethod(_ldb.ldb_get_default_basedn,None,ldb) -ldb.errstring = new_instancemethod(_ldb.ldb_errstring,None,ldb) -ldb.set_create_perms = new_instancemethod(_ldb.ldb_set_create_perms,None,ldb) -ldb.set_modules_dir = new_instancemethod(_ldb.ldb_set_modules_dir,None,ldb) -ldb.set_debug = new_instancemethod(_ldb.ldb_set_debug,None,ldb) -ldb.set_opaque = new_instancemethod(_ldb.ldb_set_opaque,None,ldb) -ldb.get_opaque = new_instancemethod(_ldb.ldb_get_opaque,None,ldb) -ldb.transaction_start = new_instancemethod(_ldb.ldb_transaction_start,None,ldb) -ldb.transaction_commit = new_instancemethod(_ldb.ldb_transaction_commit,None,ldb) -ldb.transaction_cancel = new_instancemethod(_ldb.ldb_transaction_cancel,None,ldb) -ldb.__contains__ = new_instancemethod(_ldb.ldb___contains__,None,ldb) -ldb.parse_ldif = new_instancemethod(_ldb.ldb_parse_ldif,None,ldb) -ldb_swigregister = _ldb.ldb_swigregister -ldb_swigregister(ldb) - -def Ldb(*args, **kwargs): - val = _ldb.new_Ldb(*args, **kwargs) - return val + def __init__(self, *args, **kwargs): + _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) + __swig_destroy__ = _ldb.delete_Ldb +Ldb.connect = new_instancemethod(_ldb.Ldb_connect,None,Ldb) +Ldb.search = new_instancemethod(_ldb.Ldb_search,None,Ldb) +Ldb.delete = new_instancemethod(_ldb.Ldb_delete,None,Ldb) +Ldb.rename = new_instancemethod(_ldb.Ldb_rename,None,Ldb) +Ldb.add = new_instancemethod(_ldb.Ldb_add,None,Ldb) +Ldb.modify = new_instancemethod(_ldb.Ldb_modify,None,Ldb) +Ldb.get_config_basedn = new_instancemethod(_ldb.Ldb_get_config_basedn,None,Ldb) +Ldb.get_root_basedn = new_instancemethod(_ldb.Ldb_get_root_basedn,None,Ldb) +Ldb.get_schema_basedn = new_instancemethod(_ldb.Ldb_get_schema_basedn,None,Ldb) +Ldb.get_default_basedn = new_instancemethod(_ldb.Ldb_get_default_basedn,None,Ldb) +Ldb.errstring = new_instancemethod(_ldb.Ldb_errstring,None,Ldb) +Ldb.set_create_perms = new_instancemethod(_ldb.Ldb_set_create_perms,None,Ldb) +Ldb.set_modules_dir = new_instancemethod(_ldb.Ldb_set_modules_dir,None,Ldb) +Ldb.set_debug = new_instancemethod(_ldb.Ldb_set_debug,None,Ldb) +Ldb.set_opaque = new_instancemethod(_ldb.Ldb_set_opaque,None,Ldb) +Ldb.get_opaque = new_instancemethod(_ldb.Ldb_get_opaque,None,Ldb) +Ldb.transaction_start = new_instancemethod(_ldb.Ldb_transaction_start,None,Ldb) +Ldb.transaction_commit = new_instancemethod(_ldb.Ldb_transaction_commit,None,Ldb) +Ldb.transaction_cancel = new_instancemethod(_ldb.Ldb_transaction_cancel,None,Ldb) +Ldb.__contains__ = new_instancemethod(_ldb.Ldb___contains__,None,Ldb) +Ldb.parse_ldif = new_instancemethod(_ldb.Ldb_parse_ldif,None,Ldb) +Ldb_swigregister = _ldb.Ldb_swigregister +Ldb_swigregister(Ldb) valid_attr_name = _ldb.valid_attr_name timestring = _ldb.timestring -- cgit From 6e2459211dbd59c8884049faa0d63c1712dbadfe Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 19 Dec 2007 23:27:34 +0100 Subject: r26537: Support ldb.add({'dn': 'dc=foo,bar=bla', ...}). (This used to be commit e91fe76d296973430f71502c9b614d0dfac4d83c) --- source4/lib/ldb/ldb.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 10f42b0f83..ce4a5ec494 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -89,9 +89,6 @@ Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn) Dn_swigregister = _ldb.Dn_swigregister Dn_swigregister(Dn) -ldb_dn_from_pyobject = _ldb.ldb_dn_from_pyobject -ldb_msg_element_from_pyobject = _ldb.ldb_msg_element_from_pyobject -ldb_msg_element_to_set = _ldb.ldb_msg_element_to_set class ldb_msg_element(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self): raise AttributeError, "No constructor defined" -- cgit From fb021305e4bc1175ae0d1960fbafc7eba29ef2f0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 22 Dec 2007 14:28:45 -0600 Subject: r26567: Allow registering new ldb modules from python. (This used to be commit 485db76d8476fce399a9b6cb977cf55ea35ec189) --- source4/lib/ldb/ldb.py | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index ce4a5ec494..63c6555c28 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -195,5 +195,6 @@ Ldb_swigregister(Ldb) valid_attr_name = _ldb.valid_attr_name timestring = _ldb.timestring string_to_time = _ldb.string_to_time +register_module = _ldb.register_module -- cgit From aa0a06f13c44e0eca0b3f2f0c34f0f7995b87159 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 23 Dec 2007 19:19:41 -0600 Subject: r26570: - Trim size of the swig-generated Python bindings by removing a bunch of {}'s. - Start working on Python equivalents for various EJS tests. - Fix regression in argument order for reg_diff_apply() in EJS bindings. (This used to be commit c550c03372cb260b78f6a6c132e70571bc4cb852) --- source4/lib/ldb/ldb.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 63c6555c28..160fa88dff 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -94,6 +94,14 @@ class ldb_msg_element(object): def __init__(self): raise AttributeError, "No constructor defined" __repr__ = _swig_repr __swig_destroy__ = _ldb.delete_ldb_msg_element + def __eq__(self, other): + if (isinstance(other, str) and + len(set(self)) == 1 and + set(self).pop() == other): + return True + return self.__cmp__(other) == 0 + + ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element) ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element) ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element) -- cgit From a822a14d1ec7e2635c3d004cc7488e4fd27b8d16 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 24 Dec 2007 11:02:45 -0600 Subject: r26584: Fix exception handling in ldb constructor. (This used to be commit 5383cf8e69233b3cb7c1876f52644537e459dea6) --- source4/lib/ldb/ldb.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 160fa88dff..ebf8f6025a 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -176,6 +176,11 @@ class Ldb(object): def __init__(self, *args, **kwargs): _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Ldb + 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.connect = new_instancemethod(_ldb.Ldb_connect,None,Ldb) Ldb.search = new_instancemethod(_ldb.Ldb_search,None,Ldb) Ldb.delete = new_instancemethod(_ldb.Ldb_delete,None,Ldb) -- cgit From 9269db983d847be7a0cdc9eb2bcc4ebe3066be1c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Jan 2008 00:23:33 +0100 Subject: python/ldb: Add __getitem__ implementation for LdbMessageElement. (This used to be commit e6498a0780dd31dfc623a69432004b606aeaccbe) --- source4/lib/ldb/ldb.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index ebf8f6025a..51a4a0fadb 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -94,6 +94,12 @@ class ldb_msg_element(object): def __init__(self): raise AttributeError, "No constructor defined" __repr__ = _swig_repr __swig_destroy__ = _ldb.delete_ldb_msg_element + def __getitem__(self, i): + ret = self.get(i) + if ret is None: + raise KeyError("no such value") + return ret + def __eq__(self, other): if (isinstance(other, str) and len(set(self)) == 1 and @@ -104,6 +110,7 @@ class ldb_msg_element(object): ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element) ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element) +ldb_msg_element.get = new_instancemethod(_ldb.ldb_msg_element_get,None,ldb_msg_element) ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element) ldb_msg_element_swigregister = _ldb.ldb_msg_element_swigregister ldb_msg_element_swigregister(ldb_msg_element) -- cgit From c3695026e1cfac3e835e937ed9343d82500cf197 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Jan 2008 01:02:58 +0100 Subject: ldb/python: Implement __len__ for MessageElement. (This used to be commit a8f90ed34ce9341080b63c801ef54b82de42b8e6) --- source4/lib/ldb/ldb.py | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 51a4a0fadb..2d037f080c 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -110,6 +110,7 @@ class ldb_msg_element(object): ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element) ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element) +ldb_msg_element.__len__ = new_instancemethod(_ldb.ldb_msg_element___len__,None,ldb_msg_element) ldb_msg_element.get = new_instancemethod(_ldb.ldb_msg_element_get,None,ldb_msg_element) ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element) ldb_msg_element_swigregister = _ldb.ldb_msg_element_swigregister -- cgit From 2466d2cc5e210a124bb23cb9d2c8d3cc608a7c7f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Jan 2008 01:55:56 +0100 Subject: ldb/python: Allow comparing a MessageElement to a list or a singleton. (This used to be commit 1ccbab81d79f83bb419104f2bbaf2ae7b368e90f) --- source4/lib/ldb/ldb.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 2d037f080c..6aacc8c09c 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -101,12 +101,15 @@ class ldb_msg_element(object): return ret def __eq__(self, other): - if (isinstance(other, str) and - len(set(self)) == 1 and - set(self).pop() == other): + if (len(self) == 1 and self.get(0) == other): return True - return self.__cmp__(other) == 0 - + if isinstance(other, self.__class__): + return self.__cmp__(other) == 0 + o = iter(other) + for i in range(len(self)): + if self.get(i) != o.next(): + return False + return True ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element) ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element) -- cgit From 1f4838b8a3e5f0c7c400097f56329e5a133ec4e8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Jan 2008 02:36:59 +0100 Subject: python/ldap: Wrap parse_control_strings(). (This used to be commit b27e5a68530c4fd6430cbb174b63f8ff2b6f4e53) --- source4/lib/ldb/ldb.py | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 6aacc8c09c..5a921b5394 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -196,6 +196,7 @@ Ldb.connect = new_instancemethod(_ldb.Ldb_connect,None,Ldb) Ldb.search = new_instancemethod(_ldb.Ldb_search,None,Ldb) Ldb.delete = new_instancemethod(_ldb.Ldb_delete,None,Ldb) Ldb.rename = new_instancemethod(_ldb.Ldb_rename,None,Ldb) +Ldb.parse_control_strings = new_instancemethod(_ldb.Ldb_parse_control_strings,None,Ldb) Ldb.add = new_instancemethod(_ldb.Ldb_add,None,Ldb) Ldb.modify = new_instancemethod(_ldb.Ldb_modify,None,Ldb) Ldb.get_config_basedn = new_instancemethod(_ldb.Ldb_get_config_basedn,None,Ldb) -- cgit From 1d8cdddcd0901c5886099b7596f6d9629bdfad69 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Jan 2008 03:25:22 +0100 Subject: python/ldap: Support controls argument to ldb.search(). (This used to be commit 9eddc27f13fa2feb56d6b015e66d8c54081487da) --- source4/lib/ldb/ldb.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 5a921b5394..4cc8b5268a 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -192,8 +192,16 @@ class Ldb(object): if url is not None: self.connect(url, flags, options) + def search(self, base=None, scope=SCOPE_DEFAULT, expression=None, + attrs=None, controls=None): + parsed_controls = None + if controls is not None: + parsed_controls = self.parse_control_strings(controls) + return self.search_ex(base, scope, expression, attrs, + parsed_controls) + Ldb.connect = new_instancemethod(_ldb.Ldb_connect,None,Ldb) -Ldb.search = new_instancemethod(_ldb.Ldb_search,None,Ldb) +Ldb.search_ex = new_instancemethod(_ldb.Ldb_search_ex,None,Ldb) Ldb.delete = new_instancemethod(_ldb.Ldb_delete,None,Ldb) Ldb.rename = new_instancemethod(_ldb.Ldb_rename,None,Ldb) Ldb.parse_control_strings = new_instancemethod(_ldb.Ldb_parse_control_strings,None,Ldb) -- cgit From 79d466c37397a9d3d236f1c81d7d7fda479bd052 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Jan 2008 04:05:41 +0100 Subject: ldb/python: Support comparing Dn's to strings. (This used to be commit 355878907970b396e4031426fda260d981c417eb) --- source4/lib/ldb/ldb.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 4cc8b5268a..ab2a68a4b3 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -71,6 +71,13 @@ class Dn(object): def __init__(self, *args, **kwargs): _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn + def __eq__(self, other): + if isinstance(other, self.__class__): + return self.__cmp__(other) == 0 + if isinstance(other, str): + return str(self) == other + return False + Dn.validate = new_instancemethod(_ldb.Dn_validate,None,Dn) Dn.get_casefold = new_instancemethod(_ldb.Dn_get_casefold,None,Dn) Dn.__str__ = new_instancemethod(_ldb.Dn___str__,None,Dn) -- cgit From c28c683208aad1a136c8c6decc3297bf1995aa90 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 25 Jan 2008 03:46:47 +0100 Subject: ldb/python: Add bindings for schema functions. (This used to be commit 9f6ea4692ca79c607538871c597698b98abf13d0) --- source4/lib/ldb/ldb.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index ab2a68a4b3..0bcfd36779 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -65,6 +65,7 @@ CHANGETYPE_NONE = _ldb.CHANGETYPE_NONE CHANGETYPE_ADD = _ldb.CHANGETYPE_ADD CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY +ldb_val_to_py_object = _ldb.ldb_val_to_py_object class Dn(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr @@ -218,6 +219,7 @@ Ldb.get_config_basedn = new_instancemethod(_ldb.Ldb_get_config_basedn,None,Ldb) Ldb.get_root_basedn = new_instancemethod(_ldb.Ldb_get_root_basedn,None,Ldb) Ldb.get_schema_basedn = new_instancemethod(_ldb.Ldb_get_schema_basedn,None,Ldb) Ldb.get_default_basedn = new_instancemethod(_ldb.Ldb_get_default_basedn,None,Ldb) +Ldb.schema_format_value = new_instancemethod(_ldb.Ldb_schema_format_value,None,Ldb) Ldb.errstring = new_instancemethod(_ldb.Ldb_errstring,None,Ldb) Ldb.set_create_perms = new_instancemethod(_ldb.Ldb_set_create_perms,None,Ldb) Ldb.set_modules_dir = new_instancemethod(_ldb.Ldb_set_modules_dir,None,Ldb) @@ -227,6 +229,9 @@ Ldb.get_opaque = new_instancemethod(_ldb.Ldb_get_opaque,None,Ldb) Ldb.transaction_start = new_instancemethod(_ldb.Ldb_transaction_start,None,Ldb) Ldb.transaction_commit = new_instancemethod(_ldb.Ldb_transaction_commit,None,Ldb) Ldb.transaction_cancel = new_instancemethod(_ldb.Ldb_transaction_cancel,None,Ldb) +Ldb.schema_attribute_remove = new_instancemethod(_ldb.Ldb_schema_attribute_remove,None,Ldb) +Ldb.schema_attribute_add = new_instancemethod(_ldb.Ldb_schema_attribute_add,None,Ldb) +Ldb.setup_wellknown_attributes = new_instancemethod(_ldb.Ldb_setup_wellknown_attributes,None,Ldb) Ldb.__contains__ = new_instancemethod(_ldb.Ldb___contains__,None,Ldb) Ldb.parse_ldif = new_instancemethod(_ldb.Ldb_parse_ldif,None,Ldb) Ldb_swigregister = _ldb.Ldb_swigregister -- cgit From 8ed6f6d5a825c8b0e8d66d30877a91a96fe6e7a4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 11 Apr 2008 00:43:23 +0200 Subject: Return SAM ldb context and loadparm context as part of C provision result. (This used to be commit a3e1b835656470f1a80f0fa69f53a9df849baee3) --- source4/lib/ldb/ldb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 0bcfd36779..b148782c63 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 +# Version 1.3.35 # # Don't modify this file, modify the SWIG interface instead. @@ -99,7 +99,7 @@ Dn_swigregister(Dn) class ldb_msg_element(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - def __init__(self): raise AttributeError, "No constructor defined" + def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined" __repr__ = _swig_repr __swig_destroy__ = _ldb.delete_ldb_msg_element def __getitem__(self, i): -- cgit From ae4611909609b8a0466938171812f10974dc054a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 19 May 2008 23:07:04 +0200 Subject: Add __repr__ implementations for ldb.Message, ldb.MessageElement and ldb.Dn. (This used to be commit b9119c0f0f524d43ff09825dffb24a5e77a240f4) --- source4/lib/ldb/ldb.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index b148782c63..60644d352c 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -68,7 +68,6 @@ CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY ldb_val_to_py_object = _ldb.ldb_val_to_py_object class Dn(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr def __init__(self, *args, **kwargs): _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn @@ -93,6 +92,7 @@ Dn.add_child = new_instancemethod(_ldb.Dn_add_child,None,Dn) Dn.add_base = new_instancemethod(_ldb.Dn_add_base,None,Dn) Dn.canonical_str = new_instancemethod(_ldb.Dn_canonical_str,None,Dn) Dn.canonical_ex_str = new_instancemethod(_ldb.Dn_canonical_ex_str,None,Dn) +Dn.__repr__ = new_instancemethod(_ldb.Dn___repr__,None,Dn) Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn) Dn_swigregister = _ldb.Dn_swigregister Dn_swigregister(Dn) @@ -108,6 +108,9 @@ class ldb_msg_element(object): raise KeyError("no such value") return ret + def __repr__(self): + return "MessageElement([%s])" % (",".join(repr(x) for x in self.__set__())) + def __eq__(self, other): if (len(self) == 1 and self.get(0) == other): return True @@ -139,7 +142,28 @@ class Message(object): def __init__(self, *args, **kwargs): _ldb.Message_swiginit(self,_ldb.new_Message(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Message -Message.__getitem__ = new_instancemethod(_ldb.Message___getitem__,None,Message) + def get(self, key, default=None): + if key == "dn": + return self.dn + return self.find_element(key) + + def __getitem__(self, key): + ret = self.get(key, None) + if ret is None: + raise KeyError("No such element") + return ret + + 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())) + +Message.find_element = new_instancemethod(_ldb.Message_find_element,None,Message) Message.__setitem__ = new_instancemethod(_ldb.Message___setitem__,None,Message) Message.__len__ = new_instancemethod(_ldb.Message___len__,None,Message) Message.keys = new_instancemethod(_ldb.Message_keys,None,Message) @@ -202,6 +226,8 @@ class Ldb(object): def search(self, base=None, scope=SCOPE_DEFAULT, expression=None, attrs=None, controls=None): + if not (attrs is None or isinstance(attrs, list)): + raise TypeError("attributes not a list") parsed_controls = None if controls is not None: parsed_controls = self.parse_control_strings(controls) -- cgit From 43a22c9b4a7868a740e2de417f50702209d2aced Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 19 May 2008 23:12:13 +0200 Subject: Add __repr__ implementation for Ldb. (This used to be commit 5607aea07f66f09fd5b33842d07d2fbbf44d13e7) --- source4/lib/ldb/ldb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 60644d352c..e9f4055fbf 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -215,7 +215,6 @@ LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER class Ldb(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - __repr__ = _swig_repr def __init__(self, *args, **kwargs): _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Ldb @@ -260,6 +259,7 @@ Ldb.schema_attribute_add = new_instancemethod(_ldb.Ldb_schema_attribute_add,None Ldb.setup_wellknown_attributes = new_instancemethod(_ldb.Ldb_setup_wellknown_attributes,None,Ldb) Ldb.__contains__ = new_instancemethod(_ldb.Ldb___contains__,None,Ldb) Ldb.parse_ldif = new_instancemethod(_ldb.Ldb_parse_ldif,None,Ldb) +Ldb.__repr__ = new_instancemethod(_ldb.Ldb___repr__,None,Ldb) Ldb_swigregister = _ldb.Ldb_swigregister Ldb_swigregister(Ldb) -- cgit From 505cea9d4c9ae3b7baf401fd543500041c20f93d Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 16:50:33 +0200 Subject: Add some docstrings to ldb python module, fix MessageElement name. (This used to be commit 717283331f8a1ebd80e7ec52d9bfe709f869ec86) --- source4/lib/ldb/ldb.py | 189 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 173 insertions(+), 16 deletions(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index e9f4055fbf..0149f05429 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -71,6 +71,55 @@ class Dn(object): def __init__(self, *args, **kwargs): _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn + def validate(*args, **kwargs): + """ + S.validate() -> bool + Validate DN is correct. + """ + return _ldb.Dn_validate(*args, **kwargs) + + def is_special(*args, **kwargs): + """ + S.is_special() -> bool + Check whether this is a special LDB DN. + """ + return _ldb.Dn_is_special(*args, **kwargs) + + def is_null(*args, **kwargs): + """ + S.is_null() -> bool + Check whether this is a null DN. + """ + return _ldb.Dn_is_null(*args, **kwargs) + + def add_child(*args, **kwargs): + """ + S.add_child(dn) -> None + Add a child DN to this DN. + """ + return _ldb.Dn_add_child(*args, **kwargs) + + def add_base(*args, **kwargs): + """ + S.add_base(dn) -> None + Add a base DN to this DN. + """ + return _ldb.Dn_add_base(*args, **kwargs) + + def canonical_str(*args, **kwargs): + """ + S.canonical_str() -> string + Canonical version of this DN (like a posix path). + """ + return _ldb.Dn_canonical_str(*args, **kwargs) + + def canonical_ex_str(*args, **kwargs): + """ + S.canonical_ex_str() -> string + Canonical version of this DN (like a posix path, with terminating newline). + """ + return _ldb.Dn_canonical_ex_str(*args, **kwargs) + def __eq__(self, other): if isinstance(other, self.__class__): return self.__cmp__(other) == 0 @@ -97,11 +146,13 @@ Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn) Dn_swigregister = _ldb.Dn_swigregister Dn_swigregister(Dn) -class ldb_msg_element(object): +ldb_msg_element_compare = _ldb.ldb_msg_element_compare +class MessageElement(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') - def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined" __repr__ = _swig_repr - __swig_destroy__ = _ldb.delete_ldb_msg_element + def __init__(self, *args, **kwargs): + _ldb.MessageElement_swiginit(self,_ldb.new_MessageElement(*args, **kwargs)) + __swig_destroy__ = _ldb.delete_MessageElement def __getitem__(self, i): ret = self.get(i) if ret is None: @@ -122,17 +173,12 @@ class ldb_msg_element(object): return False return True -ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element) -ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element) -ldb_msg_element.__len__ = new_instancemethod(_ldb.ldb_msg_element___len__,None,ldb_msg_element) -ldb_msg_element.get = new_instancemethod(_ldb.ldb_msg_element_get,None,ldb_msg_element) -ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element) -ldb_msg_element_swigregister = _ldb.ldb_msg_element_swigregister -ldb_msg_element_swigregister(ldb_msg_element) - -def MessageElement(*args, **kwargs): - val = _ldb.new_MessageElement(*args, **kwargs) - return val +MessageElement.__iter__ = new_instancemethod(_ldb.MessageElement___iter__,None,MessageElement) +MessageElement.__set__ = new_instancemethod(_ldb.MessageElement___set__,None,MessageElement) +MessageElement.__len__ = new_instancemethod(_ldb.MessageElement___len__,None,MessageElement) +MessageElement.get = new_instancemethod(_ldb.MessageElement_get,None,MessageElement) +MessageElement_swigregister = _ldb.MessageElement_swigregister +MessageElement_swigregister(MessageElement) ldb_msg_list_elements = _ldb.ldb_msg_list_elements class Message(object): @@ -217,14 +263,113 @@ class Ldb(object): thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) + def connect(*args, **kwargs): + """ + S.connect(url,flags=0,options=None) -> None + Connect to a LDB URL. + """ + return _ldb.Ldb_connect(*args, **kwargs) + __swig_destroy__ = _ldb.delete_Ldb + def delete(*args, **kwargs): + """ + S.delete(dn) -> None + Remove an entry. + """ + return _ldb.Ldb_delete(*args, **kwargs) + + def rename(*args, **kwargs): + """ + S.rename(old_dn, new_dn) -> None + Rename an entry. + """ + return _ldb.Ldb_rename(*args, **kwargs) + + def add(*args, **kwargs): + """ + S.add(message) -> None + Add an entry. + """ + return _ldb.Ldb_add(*args, **kwargs) + + def modify(*args, **kwargs): + """ + S.modify(message) -> None + Modify an entry. + """ + return _ldb.Ldb_modify(*args, **kwargs) + + def set_create_perms(*args, **kwargs): + """ + S.set_create_perms(mode) -> None + Set mode to use when creating new LDB files. + """ + return _ldb.Ldb_set_create_perms(*args, **kwargs) + + def set_modules_dir(*args, **kwargs): + """ + S.set_modules_dir(path) -> None + Set path LDB should search for modules + """ + return _ldb.Ldb_set_modules_dir(*args, **kwargs) + + def set_opaque(*args, **kwargs): + """ + S.set_opaque(name, value) -> None + Set an opaque value on this LDB connection. + :note: Passing incorrect values may cause crashes. + """ + return _ldb.Ldb_set_opaque(*args, **kwargs) + + def get_opaque(*args, **kwargs): + """ + S.get_opaque(name) -> value + Get an opaque value set on this LDB connection. + :note: The returned value may not be useful in Python. + """ + return _ldb.Ldb_get_opaque(*args, **kwargs) + + def transaction_start(*args, **kwargs): + """ + S.transaction_start() -> None + Start a new transaction. + """ + return _ldb.Ldb_transaction_start(*args, **kwargs) + + def transaction_commit(*args, **kwargs): + """ + S.transaction_commit() -> None + Commit currently active transaction. + """ + return _ldb.Ldb_transaction_commit(*args, **kwargs) + + def parse_ldif(*args, **kwargs): + """ + S.parse_ldif(ldif) -> iter(messages) + Parse a string formatted using LDIF. + """ + return _ldb.Ldb_parse_ldif(*args, **kwargs) + def __init__(self, url=None, flags=0, options=None): + """Create a new LDB object. + + Will also connect to the specified URL if one was given. + """ _ldb.Ldb_swiginit(self,_ldb.new_Ldb()) if url is not None: self.connect(url, flags, options) def search(self, base=None, scope=SCOPE_DEFAULT, expression=None, attrs=None, controls=None): + """Search in a database. + + :param base: Optional base DN to search + :param scope: Search scope (SCOPE_BASE, SCOPE_ONELEVEL or SCOPE_SUBTREE) + :param expression: Optional search expression + :param attrs: Attributes to return (defaults to all) + :param controls: Optional list of controls + :return: Iterator over Message objects + """ if not (attrs is None or isinstance(attrs, list)): raise TypeError("attributes not a list") parsed_controls = None @@ -263,9 +408,21 @@ Ldb.__repr__ = new_instancemethod(_ldb.Ldb___repr__,None,Ldb) Ldb_swigregister = _ldb.Ldb_swigregister Ldb_swigregister(Ldb) -valid_attr_name = _ldb.valid_attr_name + +def valid_attr_name(*args, **kwargs): + """ + S.valid_attr_name(name) -> bool + Check whether the supplied name is a valid attribute name. + """ + return _ldb.valid_attr_name(*args, **kwargs) timestring = _ldb.timestring string_to_time = _ldb.string_to_time -register_module = _ldb.register_module + +def register_module(*args, **kwargs): + """ + S.register_module(module) -> None + Register a LDB module. + """ + return _ldb.register_module(*args, **kwargs) -- cgit From fb2d69a140c123ff78df113532d4ead21f3362c3 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 17:02:31 +0200 Subject: Add more docstrings in the ldb python module. (This used to be commit a649a010670ee2c0d155aa62654841cf1f2bab8f) --- source4/lib/ldb/ldb.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 0149f05429..56f34c8605 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -67,8 +67,10 @@ CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY ldb_val_to_py_object = _ldb.ldb_val_to_py_object class Dn(object): + """A LDB Distinguished name.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): + """A LDB Distinguished name.""" _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn def validate(*args, **kwargs): @@ -148,9 +150,11 @@ Dn_swigregister(Dn) ldb_msg_element_compare = _ldb.ldb_msg_element_compare class MessageElement(object): + """A message element.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): + """A message element.""" _ldb.MessageElement_swiginit(self,_ldb.new_MessageElement(*args, **kwargs)) __swig_destroy__ = _ldb.delete_MessageElement def __getitem__(self, i): @@ -182,6 +186,7 @@ MessageElement_swigregister(MessageElement) ldb_msg_list_elements = _ldb.ldb_msg_list_elements class Message(object): + """A LDB message.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set) @@ -260,6 +265,7 @@ LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER class Ldb(object): + """A connection to a LDB database.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) @@ -343,6 +349,13 @@ class Ldb(object): """ return _ldb.Ldb_transaction_commit(*args, **kwargs) + def transaction_cancel(*args, **kwargs): + """ + S.transaction_cancel() -> None + Cancel currently active transaction. + """ + return _ldb.Ldb_transaction_cancel(*args, **kwargs) + def parse_ldif(*args, **kwargs): """ S.parse_ldif(ldif) -> iter(messages) @@ -415,7 +428,13 @@ def valid_attr_name(*args, **kwargs): Check whether the supplied name is a valid attribute name. """ return _ldb.valid_attr_name(*args, **kwargs) -timestring = _ldb.timestring + +def timestring(*args, **kwargs): + """ + S.timestring(int) -> string + Generate a LDAP time string from a UNIX timestamp + """ + return _ldb.timestring(*args, **kwargs) string_to_time = _ldb.string_to_time def register_module(*args, **kwargs): -- cgit From 9893651c0237c9dba43aadfb8f5f68be74bbfd6c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 17:15:00 +0200 Subject: Add module docstring, docstrings for constructors. (This used to be commit 67d738d6e65476263a2b7c236a57fe2b0a2dfe32) --- source4/lib/ldb/ldb.py | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 56f34c8605..e458398b0b 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -3,6 +3,10 @@ # # Don't modify this file, modify the SWIG interface instead. +""" +An interface to LDB, a LDAP-like API that can either to talk an embedded database (TDB-based) or a standards-compliant LDAP server. +""" + import _ldb import new new_instancemethod = new.instancemethod @@ -67,10 +71,13 @@ CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY ldb_val_to_py_object = _ldb.ldb_val_to_py_object class Dn(object): - """A LDB Distinguished name.""" + """A LDB distinguished name.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): - """A LDB Distinguished name.""" + """ + S.__init__(ldb, string) + Create a new DN. + """ _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs)) __swig_destroy__ = _ldb.delete_Dn def validate(*args, **kwargs): @@ -80,6 +87,13 @@ class Dn(object): """ return _ldb.Dn_validate(*args, **kwargs) + def parent(*args, **kwargs): + """ + S.parent() -> dn + Get the parent for this DN. + """ + return _ldb.Dn_parent(*args, **kwargs) + def is_special(*args, **kwargs): """ S.is_special() -> bool @@ -150,11 +164,11 @@ Dn_swigregister(Dn) ldb_msg_element_compare = _ldb.ldb_msg_element_compare class MessageElement(object): - """A message element.""" + """Message element.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args, **kwargs): - """A message element.""" + """Message element.""" _ldb.MessageElement_swiginit(self,_ldb.new_MessageElement(*args, **kwargs)) __swig_destroy__ = _ldb.delete_MessageElement def __getitem__(self, i): @@ -186,7 +200,7 @@ MessageElement_swigregister(MessageElement) ldb_msg_list_elements = _ldb.ldb_msg_list_elements class Message(object): - """A LDB message.""" + """Message.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set) @@ -265,7 +279,7 @@ LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER class Ldb(object): - """A connection to a LDB database.""" + """Connection to a LDB database.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs)) @@ -319,6 +333,14 @@ class Ldb(object): """ return _ldb.Ldb_set_modules_dir(*args, **kwargs) + def set_debug(*args, **kwargs): + """ + S.set_debug(callback) -> None + Set callback for LDB debug messages. + The callback should accept a debug level and debug text. + """ + return _ldb.Ldb_set_debug(*args, **kwargs) + def set_opaque(*args, **kwargs): """ S.set_opaque(name, value) -> None @@ -435,7 +457,13 @@ def timestring(*args, **kwargs): Generate a LDAP time string from a UNIX timestamp """ return _ldb.timestring(*args, **kwargs) -string_to_time = _ldb.string_to_time + +def string_to_time(*args, **kwargs): + """ + S.string_to_time(string) -> int + Parse a LDAP time string into a UNIX timestamp. + """ + return _ldb.string_to_time(*args, **kwargs) def register_module(*args, **kwargs): """ -- cgit From c401aa93573460f10256218a6a1902839b17b884 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 22 May 2008 17:42:18 +0200 Subject: Use restructuredText formatting for docstrings. (This used to be commit 0cc58decd74d20f3d7dff93ddef1c8bce4d49ad0) --- source4/lib/ldb/ldb.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index e458398b0b..03869799c2 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -471,5 +471,7 @@ def register_module(*args, **kwargs): Register a LDB module. """ return _ldb.register_module(*args, **kwargs) +__docformat__ = "restructuredText" + -- cgit From 564b6ed025bdfbd93876e084e9f3dd1a6774fa5c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 23 May 2008 04:07:42 +0200 Subject: Add proper implementation of MessageElement.__cmp__. (This used to be commit 076e2cc356978ac313fcfdf8d8243f4ed1d629b0) --- source4/lib/ldb/ldb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index 03869799c2..ae2c187367 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -162,7 +162,6 @@ Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn) Dn_swigregister = _ldb.Dn_swigregister Dn_swigregister(Dn) -ldb_msg_element_compare = _ldb.ldb_msg_element_compare class MessageElement(object): """Message element.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') @@ -191,6 +190,7 @@ class MessageElement(object): return False return True +MessageElement.__cmp__ = new_instancemethod(_ldb.MessageElement___cmp__,None,MessageElement) MessageElement.__iter__ = new_instancemethod(_ldb.MessageElement___iter__,None,MessageElement) MessageElement.__set__ = new_instancemethod(_ldb.MessageElement___set__,None,MessageElement) MessageElement.__len__ = new_instancemethod(_ldb.MessageElement___len__,None,MessageElement) -- cgit From 9817f3d785ceb67819a9def0e8030272e4ba9e14 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 30 Aug 2008 07:32:44 +1000 Subject: Add a setexpiry operation in samdb.py This makes it easy to set the expiry (or no expiry) for a samdb user (This used to be commit 25171f18a4b242b5a731f4ac1eefc51cc82efd74) --- source4/lib/ldb/ldb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/ldb/ldb.py') diff --git a/source4/lib/ldb/ldb.py b/source4/lib/ldb/ldb.py index ae2c187367..5826c6b752 100644 --- a/source4/lib/ldb/ldb.py +++ b/source4/lib/ldb/ldb.py @@ -1,5 +1,5 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.35 +# Version 1.3.36 # # Don't modify this file, modify the SWIG interface instead. -- cgit