diff options
| author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-18 17:21:13 +0100 |
|---|---|---|
| committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:51:44 +0100 |
| commit | 1c29a63d443fde3fc0253f634822c12749f1afad (patch) | |
| tree | 43d6633a24b722c63cf7a0360416462f9be25563 /source4/scripting/python/samba/__init__.py | |
| parent | 54a48d40a10c813954e4b777377607bb8366a57e (diff) | |
| download | samba-1c29a63d443fde3fc0253f634822c12749f1afad.tar.gz samba-1c29a63d443fde3fc0253f634822c12749f1afad.tar.bz2 samba-1c29a63d443fde3fc0253f634822c12749f1afad.zip | |
r26523: Refactor provisioning code.
(This used to be commit ac1083178f9e521dcd5d3d8b5199abcb00159adf)
Diffstat (limited to 'source4/scripting/python/samba/__init__.py')
| -rw-r--r-- | source4/scripting/python/samba/__init__.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py index fd294952b8d..39814646817 100644 --- a/source4/scripting/python/samba/__init__.py +++ b/source4/scripting/python/samba/__init__.py @@ -77,7 +77,7 @@ class Ldb(ldb.Ldb): def msg(l,text): print text - self.set_debug(msg) + #self.set_debug(msg) if url is not None: self.connect(url) @@ -87,9 +87,9 @@ class Ldb(ldb.Ldb): set_session_info = misc.ldb_set_session_info set_loadparm = misc.ldb_set_loadparm - def searchone(self, basedn, expression, attribute): + def searchone(self, basedn, attribute, expression=None, scope=ldb.SCOPE_BASE): """Search for one attribute as a string.""" - res = self.search(basedn, SCOPE_SUBTREE, expression, [attribute]) + res = self.search(basedn, scope, expression, [attribute]) if len(res) != 1 or res[0][attribute] is None: return None return res[0][attribute] @@ -125,6 +125,8 @@ def substitute_var(text, values): """ for (name, value) in values.items(): + assert isinstance(name, str), "%r is not a string" % name + assert isinstance(value, str), "Value %r for %s is not a string" % (value, name) text = text.replace("${%s}" % name, value) assert "${" not in text, text |
