Py_RETURN_NONE;
}
+static PyObject *obj_set_global_parameter(py_SMBConf_Object * self,
+ PyObject * args)
+{
+ sbcErr err;
+ char *param = NULL;
+ char *val = NULL;
+
+ if (!PyArg_ParseTuple(args, "ss", ¶m, &val)) {
+ return NULL;
+ }
+
+ err = smbconf_set_global_parameter(self->conf_ctx, param, val);
+ if (err != SBC_ERR_OK) {
+ py_raise_SMBConfError(err);
+ return NULL;
+ }
+ Py_RETURN_NONE;
+}
+
PyDoc_STRVAR(obj_requires_messaging_doc,
"requires_messaging() -> bool\n"
"\n"
"Set a configuration parmeter. Specify service name, parameter name,\n"
"and parameter value.\n");
+PyDoc_STRVAR(obj_set_global_parameter_doc,
+"set_global_parameter(str, str) -> None\n"
+"Set a global configuration parmeter. Specify the parameter name\n"
+"and parameter value.\n");
+
static PyMethodDef py_smbconf_obj_methods[] = {
{ "requires_messaging", (PyCFunction) obj_requires_messaging,
METH_NOARGS, obj_requires_messaging_doc },
obj_drop_doc },
{ "set_parameter", (PyCFunction) obj_set_parameter, METH_VARARGS,
obj_set_parameter_doc },
+ { "set_global_parameter", (PyCFunction) obj_set_global_parameter,
+ METH_VARARGS, obj_set_global_parameter_doc },
{ 0 },
};
s1, ("foobar", [("path", "/mnt/foobar"), ("browseable", "no")])
)
+ def test_set_global_parameter(self):
+ sconf = self.s3smbconf.init_reg(None)
+ sconf.drop()
+ sconf.set_global_parameter("workgroup", "EXAMPLE")
+ sconf.set_global_parameter("x:custom", "fake")
+
+ s1 = sconf.get_share("global")
+ self.assertEqual(
+ s1, ("global", [("workgroup", "EXAMPLE"), ("x:custom", "fake")])
+ )
+
if __name__ == "__main__":
import unittest