pydsdb: Mark all SamDB and Schema methods that are in pydsdb as
authorJelmer Vernooij <jelmer@samba.org>
Sun, 20 Jun 2010 13:22:49 +0000 (15:22 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 20 Jun 2010 13:22:49 +0000 (15:22 +0200)
private, to discourage them being called directly.

source4/dsdb/pydsdb.c
source4/scripting/python/samba/__init__.py
source4/scripting/python/samba/samdb.py
source4/scripting/python/samba/schema.py

index a911afc8e69b6ef252e4d5eebf81b911b8638e15..bddda8d092c67e5741b27b3c6e9d960772606600 100644 (file)
@@ -462,46 +462,46 @@ static PyObject *py_dsdb_write_prefixes_from_schema_to_ldb(PyObject *self, PyObj
 
 
 static PyMethodDef py_dsdb_methods[] = {
-       { "samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
+       { "_samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
                METH_VARARGS, "Get the server site name as a string"},
-       { "dsdb_convert_schema_to_openldap",
+       { "_dsdb_convert_schema_to_openldap",
                (PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS, 
                "dsdb_convert_schema_to_openldap(ldb, target_str, mapping) -> str\n"
                "Create an OpenLDAP schema from a schema." },
-       { "samdb_set_domain_sid", (PyCFunction)py_samdb_set_domain_sid,
+       { "_samdb_set_domain_sid", (PyCFunction)py_samdb_set_domain_sid,
                METH_VARARGS,
                "samdb_set_domain_sid(samdb, sid)\n"
                "Set SID of domain to use." },
-       { "samdb_get_domain_sid", (PyCFunction)py_samdb_get_domain_sid,
+       { "_samdb_get_domain_sid", (PyCFunction)py_samdb_get_domain_sid,
                METH_VARARGS,
                "samdb_get_domain_sid(samdb)\n"
                "Get SID of domain in use." },
-       { "samdb_ntds_invocation_id", (PyCFunction)py_samdb_ntds_invocation_id,
+       { "_samdb_ntds_invocation_id", (PyCFunction)py_samdb_ntds_invocation_id,
                METH_VARARGS, "get the NTDS invocation ID GUID as a string"},
-       { "samdb_set_ntds_settings_dn", (PyCFunction)py_samdb_set_ntds_settings_dn,
+       { "_samdb_set_ntds_settings_dn", (PyCFunction)py_samdb_set_ntds_settings_dn,
                METH_VARARGS,
                "samdb_set_ntds_settings_dn(samdb, ntds_settings_dn)\n"
                "Set NTDS Settings DN for this LDB (allows it to be set before the DB fully exists)." },
-       { "dsdb_get_oid_from_attid", (PyCFunction)py_dsdb_get_oid_from_attid,
+       { "_dsdb_get_oid_from_attid", (PyCFunction)py_dsdb_get_oid_from_attid,
                METH_VARARGS, NULL },
-       { "dsdb_set_ntds_invocation_id",
+       { "_dsdb_set_ntds_invocation_id",
                (PyCFunction)py_dsdb_set_ntds_invocation_id, METH_VARARGS,
                NULL },
-       { "samdb_ntds_objectGUID", (PyCFunction)py_samdb_ntds_objectGUID,
+       { "_samdb_ntds_objectGUID", (PyCFunction)py_samdb_ntds_objectGUID,
                METH_VARARGS, "get the NTDS objectGUID as a string"},
-       { "dsdb_set_global_schema", (PyCFunction)py_dsdb_set_global_schema,
+       { "_dsdb_set_global_schema", (PyCFunction)py_dsdb_set_global_schema,
                METH_VARARGS, NULL },
-       { "dsdb_load_partition_usn", (PyCFunction)py_dsdb_load_partition_usn,
+       { "_dsdb_load_partition_usn", (PyCFunction)py_dsdb_load_partition_usn,
                METH_VARARGS,
                "get uSNHighest and uSNUrgent from the partition @REPLCHANGED"},
-       { "dsdb_set_am_rodc",
+       { "_dsdb_set_am_rodc",
                (PyCFunction)py_dsdb_set_am_rodc, METH_VARARGS,
                NULL },
-       { "dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS,
+       { "_dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS,
                NULL },
-       { "dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
+       { "_dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
                NULL },
-       { "dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS,
+       { "_dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS,
                NULL },
        { NULL }
 };
index a6532b7f0d619ec65d77a693295a65faefe70a47..915729310d7f63f633c43e73f04d7742936eb4f9 100644 (file)
@@ -42,7 +42,6 @@ else:
 
 
 import ldb
-import _glue
 from samba._ldb import Ldb as _Ldb
 
 class Ldb(_Ldb):
@@ -264,7 +263,7 @@ class Ldb(_Ldb):
 
 def substitute_var(text, values):
     """Substitute strings of the form ${NAME} in str, replacing
-    with substitutions from subobj.
+    with substitutions from values.
 
     :param text: Text in which to subsitute.
     :param values: Dictionary with keys and values.
@@ -355,6 +354,7 @@ def ensure_external_module(modulename, location):
             sys.modules[modulename] = __import__(
                 "samba.external.%s" % modulename, fromlist=["samba.external"])
 
+import _glue
 version = _glue.version
 interface_ips = _glue.interface_ips
 set_debug_level = _glue.set_debug_level
index 23f33b6bc47712f1734838b0ceba96e1738cf6ac..6d49bddfb3a9571900aa04a08d526a1653c25f8e 100644 (file)
@@ -48,9 +48,9 @@ class SamDB(samba.Ldb):
                 options=options)
 
         if global_schema:
-            dsdb.dsdb_set_global_schema(self)
+            dsdb._dsdb_set_global_schema(self)
 
-        dsdb.dsdb_set_am_rodc(self, am_rodc)
+        dsdb._dsdb_set_am_rodc(self, am_rodc)
 
     def connect(self, url=None, flags=0, options=None):
         if self.lp is not None:
@@ -422,27 +422,27 @@ accountExpires: %u
 
         :param sid: The new domain sid to use.
         """
-        dsdb.samdb_set_domain_sid(self, sid)
+        dsdb._samdb_set_domain_sid(self, sid)
 
     def get_domain_sid(self):
         """Read the domain SID used by this LDB.
 
         """
-        dsdb.samdb_get_domain_sid(self)
+        dsdb._samdb_get_domain_sid(self)
 
     def set_invocation_id(self, invocation_id):
         """Set the invocation id for this SamDB handle.
 
         :param invocation_id: GUID of the invocation id.
         """
-        dsdb.dsdb_set_ntds_invocation_id(self, invocation_id)
+        dsdb._dsdb_set_ntds_invocation_id(self, invocation_id)
 
     def get_oid_from_attid(self, attid):
-        return dsdb.dsdb_get_oid_from_attid(self, attid)
+        return dsdb._dsdb_get_oid_from_attid(self, attid)
 
     def get_invocation_id(self):
         "Get the invocation_id id"
-        return dsdb.samdb_ntds_invocation_id(self)
+        return dsdb._samdb_ntds_invocation_id(self)
 
     def set_ntds_settings_dn(self, ntds_settings_dn):
         """Set the NTDS Settings DN, as would be returned on the dsServiceName rootDSE attribute
@@ -451,7 +451,7 @@ accountExpires: %u
 
         :param ntds_settings_dn: The new DN to use
         """
-        dsdb.samdb_set_ntds_settings_dn(self, ntds_settings_dn)
+        dsdb._samdb_set_ntds_settings_dn(self, ntds_settings_dn)
 
     invocation_id = property(get_invocation_id, set_invocation_id)
 
@@ -459,20 +459,20 @@ accountExpires: %u
 
     def get_ntds_GUID(self):
         "Get the NTDS objectGUID"
-        return dsdb.samdb_ntds_objectGUID(self)
+        return dsdb._samdb_ntds_objectGUID(self)
 
     def server_site_name(self):
         "Get the server site name"
-        return dsdb.samdb_server_site_name(self)
+        return dsdb._samdb_server_site_name(self)
 
     def load_partition_usn(self, base_dn):
-        return dsdb.dsdb_load_partition_usn(self, base_dn)
+        return dsdb._dsdb_load_partition_usn(self, base_dn)
 
     def set_schema(self, schema):
         self.set_schema_from_ldb(schema.ldb)
 
     def set_schema_from_ldb(self, ldb):
-        dsdb.dsdb_set_schema_from_ldb(self, ldb)
+        dsdb._dsdb_set_schema_from_ldb(self, ldb)
 
     def write_prefixes_from_schema(self):
-        dsdb.dsdb_write_prefixes_from_schema_to_ldb(self)
+        dsdb._dsdb_write_prefixes_from_schema_to_ldb(self)
index 9e8db65d6e75cd303ed66668ee6020a1a634dc9c..c25dc195b1dfd148a46efe630b34fbcdf192022e 100644 (file)
@@ -109,7 +109,7 @@ class Schema(object):
         self.set_from_ldif(prefixmap_ldif, self.schema_data)
 
     def set_from_ldif(self, pf, df):
-        dsdb.dsdb_set_schema_from_ldif(self.ldb, pf, df)
+        dsdb._dsdb_set_schema_from_ldif(self.ldb, pf, df)
 
     def write_to_tmp_ldb(self, schemadb_path):
         self.ldb.connect(url=schemadb_path)
@@ -140,7 +140,7 @@ dn: @INDEXLIST
         return get_dnsyntax_attributes(self.schemadn, self.ldb)
 
     def convert_to_openldap(self, target, mapping):
-        return dsdb.dsdb_convert_schema_to_openldap(self.ldb, target, mapping)
+        return dsdb._dsdb_convert_schema_to_openldap(self.ldb, target, mapping)
 
 
 # Return a hash with the forward attribute as a key and the back as the value