ldb/python: Add bindings for schema functions.
[ira/wip.git] / source / lib / ldb / ldb.py
1 # This file was automatically generated by SWIG (http://www.swig.org).
2 # Version 1.3.33
3 #
4 # Don't modify this file, modify the SWIG interface instead.
5
6 import _ldb
7 import new
8 new_instancemethod = new.instancemethod
9 try:
10     _swig_property = property
11 except NameError:
12     pass # Python < 2.2 doesn't have 'property'.
13 def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
14     if (name == "thisown"): return self.this.own(value)
15     if (name == "this"):
16         if type(value).__name__ == 'PySwigObject':
17             self.__dict__[name] = value
18             return
19     method = class_type.__swig_setmethods__.get(name,None)
20     if method: return method(self,value)
21     if (not static) or hasattr(self,name):
22         self.__dict__[name] = value
23     else:
24         raise AttributeError("You cannot add attributes to %s" % self)
25
26 def _swig_setattr(self,class_type,name,value):
27     return _swig_setattr_nondynamic(self,class_type,name,value,0)
28
29 def _swig_getattr(self,class_type,name):
30     if (name == "thisown"): return self.this.own()
31     method = class_type.__swig_getmethods__.get(name,None)
32     if method: return method(self)
33     raise AttributeError,name
34
35 def _swig_repr(self):
36     try: strthis = "proxy of " + self.this.__repr__()
37     except: strthis = ""
38     return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
39
40 import types
41 try:
42     _object = types.ObjectType
43     _newclass = 1
44 except AttributeError:
45     class _object : pass
46     _newclass = 0
47 del types
48
49
50 def _swig_setattr_nondynamic_method(set):
51     def set_attr(self,name,value):
52         if (name == "thisown"): return self.this.own(value)
53         if hasattr(self,name) or (name == "this"):
54             set(self,name,value)
55         else:
56             raise AttributeError("You cannot add attributes to %s" % self)
57     return set_attr
58
59
60 SCOPE_DEFAULT = _ldb.SCOPE_DEFAULT
61 SCOPE_BASE = _ldb.SCOPE_BASE
62 SCOPE_ONELEVEL = _ldb.SCOPE_ONELEVEL
63 SCOPE_SUBTREE = _ldb.SCOPE_SUBTREE
64 CHANGETYPE_NONE = _ldb.CHANGETYPE_NONE
65 CHANGETYPE_ADD = _ldb.CHANGETYPE_ADD
66 CHANGETYPE_DELETE = _ldb.CHANGETYPE_DELETE
67 CHANGETYPE_MODIFY = _ldb.CHANGETYPE_MODIFY
68 ldb_val_to_py_object = _ldb.ldb_val_to_py_object
69 class Dn(object):
70     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
71     __repr__ = _swig_repr
72     def __init__(self, *args, **kwargs): 
73         _ldb.Dn_swiginit(self,_ldb.new_Dn(*args, **kwargs))
74     __swig_destroy__ = _ldb.delete_Dn
75     def __eq__(self, other):
76         if isinstance(other, self.__class__):
77             return self.__cmp__(other) == 0
78         if isinstance(other, str):
79             return str(self) == other
80         return False
81
82 Dn.validate = new_instancemethod(_ldb.Dn_validate,None,Dn)
83 Dn.get_casefold = new_instancemethod(_ldb.Dn_get_casefold,None,Dn)
84 Dn.__str__ = new_instancemethod(_ldb.Dn___str__,None,Dn)
85 Dn.parent = new_instancemethod(_ldb.Dn_parent,None,Dn)
86 Dn.__cmp__ = new_instancemethod(_ldb.Dn___cmp__,None,Dn)
87 Dn.is_valid = new_instancemethod(_ldb.Dn_is_valid,None,Dn)
88 Dn.is_special = new_instancemethod(_ldb.Dn_is_special,None,Dn)
89 Dn.is_null = new_instancemethod(_ldb.Dn_is_null,None,Dn)
90 Dn.check_special = new_instancemethod(_ldb.Dn_check_special,None,Dn)
91 Dn.__len__ = new_instancemethod(_ldb.Dn___len__,None,Dn)
92 Dn.add_child = new_instancemethod(_ldb.Dn_add_child,None,Dn)
93 Dn.add_base = new_instancemethod(_ldb.Dn_add_base,None,Dn)
94 Dn.canonical_str = new_instancemethod(_ldb.Dn_canonical_str,None,Dn)
95 Dn.canonical_ex_str = new_instancemethod(_ldb.Dn_canonical_ex_str,None,Dn)
96 Dn.__add__ = new_instancemethod(_ldb.Dn___add__,None,Dn)
97 Dn_swigregister = _ldb.Dn_swigregister
98 Dn_swigregister(Dn)
99
100 class ldb_msg_element(object):
101     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
102     def __init__(self): raise AttributeError, "No constructor defined"
103     __repr__ = _swig_repr
104     __swig_destroy__ = _ldb.delete_ldb_msg_element
105     def __getitem__(self, i):
106         ret = self.get(i)
107         if ret is None:
108             raise KeyError("no such value")
109         return ret
110
111     def __eq__(self, other):
112         if (len(self) == 1 and self.get(0) == other):
113             return True
114         if isinstance(other, self.__class__):
115             return self.__cmp__(other) == 0
116         o = iter(other)
117         for i in range(len(self)):
118             if self.get(i) != o.next():
119                 return False
120         return True
121
122 ldb_msg_element.__iter__ = new_instancemethod(_ldb.ldb_msg_element___iter__,None,ldb_msg_element)
123 ldb_msg_element.__set__ = new_instancemethod(_ldb.ldb_msg_element___set__,None,ldb_msg_element)
124 ldb_msg_element.__len__ = new_instancemethod(_ldb.ldb_msg_element___len__,None,ldb_msg_element)
125 ldb_msg_element.get = new_instancemethod(_ldb.ldb_msg_element_get,None,ldb_msg_element)
126 ldb_msg_element.__cmp__ = new_instancemethod(_ldb.ldb_msg_element___cmp__,None,ldb_msg_element)
127 ldb_msg_element_swigregister = _ldb.ldb_msg_element_swigregister
128 ldb_msg_element_swigregister(ldb_msg_element)
129
130 def MessageElement(*args, **kwargs):
131     val = _ldb.new_MessageElement(*args, **kwargs)
132     return val
133
134 ldb_msg_list_elements = _ldb.ldb_msg_list_elements
135 class Message(object):
136     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
137     __repr__ = _swig_repr
138     dn = _swig_property(_ldb.Message_dn_get, _ldb.Message_dn_set)
139     def __init__(self, *args, **kwargs): 
140         _ldb.Message_swiginit(self,_ldb.new_Message(*args, **kwargs))
141     __swig_destroy__ = _ldb.delete_Message
142 Message.__getitem__ = new_instancemethod(_ldb.Message___getitem__,None,Message)
143 Message.__setitem__ = new_instancemethod(_ldb.Message___setitem__,None,Message)
144 Message.__len__ = new_instancemethod(_ldb.Message___len__,None,Message)
145 Message.keys = new_instancemethod(_ldb.Message_keys,None,Message)
146 Message.__iter__ = new_instancemethod(_ldb.Message___iter__,None,Message)
147 Message.__delitem__ = new_instancemethod(_ldb.Message___delitem__,None,Message)
148 Message_swigregister = _ldb.Message_swigregister
149 Message_swigregister(Message)
150
151 ldb_ldif_to_pyobject = _ldb.ldb_ldif_to_pyobject
152 LdbError = _ldb.LdbError
153
154 LDB_ERR_OPERATIONS_ERROR = _ldb.LDB_ERR_OPERATIONS_ERROR
155 LDB_ERR_PROTOCOL_ERROR = _ldb.LDB_ERR_PROTOCOL_ERROR
156 LDB_ERR_TIME_LIMIT_EXCEEDED = _ldb.LDB_ERR_TIME_LIMIT_EXCEEDED
157 LDB_ERR_SIZE_LIMIT_EXCEEDED = _ldb.LDB_ERR_SIZE_LIMIT_EXCEEDED
158 LDB_ERR_COMPARE_FALSE = _ldb.LDB_ERR_COMPARE_FALSE
159 LDB_ERR_COMPARE_TRUE = _ldb.LDB_ERR_COMPARE_TRUE
160 LDB_ERR_AUTH_METHOD_NOT_SUPPORTED = _ldb.LDB_ERR_AUTH_METHOD_NOT_SUPPORTED
161 LDB_ERR_STRONG_AUTH_REQUIRED = _ldb.LDB_ERR_STRONG_AUTH_REQUIRED
162 LDB_ERR_REFERRAL = _ldb.LDB_ERR_REFERRAL
163 LDB_ERR_ADMIN_LIMIT_EXCEEDED = _ldb.LDB_ERR_ADMIN_LIMIT_EXCEEDED
164 LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION = _ldb.LDB_ERR_UNSUPPORTED_CRITICAL_EXTENSION
165 LDB_ERR_CONFIDENTIALITY_REQUIRED = _ldb.LDB_ERR_CONFIDENTIALITY_REQUIRED
166 LDB_ERR_SASL_BIND_IN_PROGRESS = _ldb.LDB_ERR_SASL_BIND_IN_PROGRESS
167 LDB_ERR_NO_SUCH_ATTRIBUTE = _ldb.LDB_ERR_NO_SUCH_ATTRIBUTE
168 LDB_ERR_UNDEFINED_ATTRIBUTE_TYPE = _ldb.LDB_ERR_UNDEFINED_ATTRIBUTE_TYPE
169 LDB_ERR_INAPPROPRIATE_MATCHING = _ldb.LDB_ERR_INAPPROPRIATE_MATCHING
170 LDB_ERR_CONSTRAINT_VIOLATION = _ldb.LDB_ERR_CONSTRAINT_VIOLATION
171 LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS = _ldb.LDB_ERR_ATTRIBUTE_OR_VALUE_EXISTS
172 LDB_ERR_INVALID_ATTRIBUTE_SYNTAX = _ldb.LDB_ERR_INVALID_ATTRIBUTE_SYNTAX
173 LDB_ERR_NO_SUCH_OBJECT = _ldb.LDB_ERR_NO_SUCH_OBJECT
174 LDB_ERR_ALIAS_PROBLEM = _ldb.LDB_ERR_ALIAS_PROBLEM
175 LDB_ERR_INVALID_DN_SYNTAX = _ldb.LDB_ERR_INVALID_DN_SYNTAX
176 LDB_ERR_ALIAS_DEREFERENCING_PROBLEM = _ldb.LDB_ERR_ALIAS_DEREFERENCING_PROBLEM
177 LDB_ERR_INAPPROPRIATE_AUTHENTICATION = _ldb.LDB_ERR_INAPPROPRIATE_AUTHENTICATION
178 LDB_ERR_INVALID_CREDENTIALS = _ldb.LDB_ERR_INVALID_CREDENTIALS
179 LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS = _ldb.LDB_ERR_INSUFFICIENT_ACCESS_RIGHTS
180 LDB_ERR_BUSY = _ldb.LDB_ERR_BUSY
181 LDB_ERR_UNAVAILABLE = _ldb.LDB_ERR_UNAVAILABLE
182 LDB_ERR_UNWILLING_TO_PERFORM = _ldb.LDB_ERR_UNWILLING_TO_PERFORM
183 LDB_ERR_LOOP_DETECT = _ldb.LDB_ERR_LOOP_DETECT
184 LDB_ERR_NAMING_VIOLATION = _ldb.LDB_ERR_NAMING_VIOLATION
185 LDB_ERR_OBJECT_CLASS_VIOLATION = _ldb.LDB_ERR_OBJECT_CLASS_VIOLATION
186 LDB_ERR_NOT_ALLOWED_ON_NON_LEAF = _ldb.LDB_ERR_NOT_ALLOWED_ON_NON_LEAF
187 LDB_ERR_NOT_ALLOWED_ON_RDN = _ldb.LDB_ERR_NOT_ALLOWED_ON_RDN
188 LDB_ERR_ENTRY_ALREADY_EXISTS = _ldb.LDB_ERR_ENTRY_ALREADY_EXISTS
189 LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED = _ldb.LDB_ERR_OBJECT_CLASS_MODS_PROHIBITED
190 LDB_ERR_AFFECTS_MULTIPLE_DSAS = _ldb.LDB_ERR_AFFECTS_MULTIPLE_DSAS
191 LDB_ERR_OTHER = _ldb.LDB_ERR_OTHER
192 class Ldb(object):
193     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
194     __repr__ = _swig_repr
195     def __init__(self, *args, **kwargs): 
196         _ldb.Ldb_swiginit(self,_ldb.new_Ldb(*args, **kwargs))
197     __swig_destroy__ = _ldb.delete_Ldb
198     def __init__(self, url=None, flags=0, options=None):
199         _ldb.Ldb_swiginit(self,_ldb.new_Ldb())
200         if url is not None:
201             self.connect(url, flags, options)
202
203     def search(self, base=None, scope=SCOPE_DEFAULT, expression=None, 
204                attrs=None, controls=None):
205         parsed_controls = None
206         if controls is not None:
207             parsed_controls = self.parse_control_strings(controls)
208         return self.search_ex(base, scope, expression, attrs, 
209                               parsed_controls)
210
211 Ldb.connect = new_instancemethod(_ldb.Ldb_connect,None,Ldb)
212 Ldb.search_ex = new_instancemethod(_ldb.Ldb_search_ex,None,Ldb)
213 Ldb.delete = new_instancemethod(_ldb.Ldb_delete,None,Ldb)
214 Ldb.rename = new_instancemethod(_ldb.Ldb_rename,None,Ldb)
215 Ldb.parse_control_strings = new_instancemethod(_ldb.Ldb_parse_control_strings,None,Ldb)
216 Ldb.add = new_instancemethod(_ldb.Ldb_add,None,Ldb)
217 Ldb.modify = new_instancemethod(_ldb.Ldb_modify,None,Ldb)
218 Ldb.get_config_basedn = new_instancemethod(_ldb.Ldb_get_config_basedn,None,Ldb)
219 Ldb.get_root_basedn = new_instancemethod(_ldb.Ldb_get_root_basedn,None,Ldb)
220 Ldb.get_schema_basedn = new_instancemethod(_ldb.Ldb_get_schema_basedn,None,Ldb)
221 Ldb.get_default_basedn = new_instancemethod(_ldb.Ldb_get_default_basedn,None,Ldb)
222 Ldb.schema_format_value = new_instancemethod(_ldb.Ldb_schema_format_value,None,Ldb)
223 Ldb.errstring = new_instancemethod(_ldb.Ldb_errstring,None,Ldb)
224 Ldb.set_create_perms = new_instancemethod(_ldb.Ldb_set_create_perms,None,Ldb)
225 Ldb.set_modules_dir = new_instancemethod(_ldb.Ldb_set_modules_dir,None,Ldb)
226 Ldb.set_debug = new_instancemethod(_ldb.Ldb_set_debug,None,Ldb)
227 Ldb.set_opaque = new_instancemethod(_ldb.Ldb_set_opaque,None,Ldb)
228 Ldb.get_opaque = new_instancemethod(_ldb.Ldb_get_opaque,None,Ldb)
229 Ldb.transaction_start = new_instancemethod(_ldb.Ldb_transaction_start,None,Ldb)
230 Ldb.transaction_commit = new_instancemethod(_ldb.Ldb_transaction_commit,None,Ldb)
231 Ldb.transaction_cancel = new_instancemethod(_ldb.Ldb_transaction_cancel,None,Ldb)
232 Ldb.schema_attribute_remove = new_instancemethod(_ldb.Ldb_schema_attribute_remove,None,Ldb)
233 Ldb.schema_attribute_add = new_instancemethod(_ldb.Ldb_schema_attribute_add,None,Ldb)
234 Ldb.setup_wellknown_attributes = new_instancemethod(_ldb.Ldb_setup_wellknown_attributes,None,Ldb)
235 Ldb.__contains__ = new_instancemethod(_ldb.Ldb___contains__,None,Ldb)
236 Ldb.parse_ldif = new_instancemethod(_ldb.Ldb_parse_ldif,None,Ldb)
237 Ldb_swigregister = _ldb.Ldb_swigregister
238 Ldb_swigregister(Ldb)
239
240 valid_attr_name = _ldb.valid_attr_name
241 timestring = _ldb.timestring
242 string_to_time = _ldb.string_to_time
243 register_module = _ldb.register_module
244
245