Add bindings for lp_load_default().
authorJelmer Vernooij <jelmer@samba.org>
Wed, 23 Jan 2008 22:15:39 +0000 (23:15 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 23 Jan 2008 22:38:57 +0000 (23:38 +0100)
source/param/param.i
source/param/param.py
source/param/param_wrap.c
source/param/tests/bindings.py

index eeecb0e5b90a53be15f848c3d5a15982ec259397..7322302117ef43c3ffb374948ac5eab60af0a9a9 100644 (file)
@@ -50,6 +50,7 @@ typedef struct loadparm_context {
     %extend {
         loadparm_context(TALLOC_CTX *mem_ctx) { return loadparm_init(mem_ctx); }
         bool load(const char *filename) { return lp_load($self, filename); }
+        bool load_default() { return lp_load_default($self); }
 #ifdef SWIGPYTHON
         int __len__() { return lp_numservices($self); }
         struct loadparm_service *__getitem__(const char *name) { return lp_service($self, name); }
index 66b51e5d3b18344d3eb3b76db902e7ddcf16fe61..5adf7a4ecc39f0b27572c2e3bd830347f81e3436 100644 (file)
@@ -64,6 +64,7 @@ class LoadParm(object):
         _param.LoadParm_swiginit(self,_param.new_LoadParm(*args, **kwargs))
     __swig_destroy__ = _param.delete_LoadParm
 LoadParm.load = new_instancemethod(_param.LoadParm_load,None,LoadParm)
+LoadParm.load_default = new_instancemethod(_param.LoadParm_load_default,None,LoadParm)
 LoadParm.__len__ = new_instancemethod(_param.LoadParm___len__,None,LoadParm)
 LoadParm.__getitem__ = new_instancemethod(_param.LoadParm___getitem__,None,LoadParm)
 LoadParm.configfile = new_instancemethod(_param.LoadParm_configfile,None,LoadParm)
index d8be725c5e9a6aee0f308de749d1cfca183325ca..275e2d67ecbe36819bf608ac018a456396c49948 100644 (file)
@@ -2602,6 +2602,7 @@ SWIGINTERNINLINE PyObject*
   return PyBool_FromLong(value ? 1 : 0);
 }
 
+SWIGINTERN bool loadparm_context_load_default(loadparm_context *self){ return lp_load_default(self); }
 SWIGINTERN int loadparm_context___len__(loadparm_context *self){ return lp_numservices(self); }
 
   #define SWIG_From_long   PyInt_FromLong 
@@ -2840,6 +2841,34 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_LoadParm_load_default(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  loadparm_context *arg1 = (loadparm_context *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  PyObject * obj0 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self", NULL 
+  };
+  
+  arg1 = loadparm_init(NULL);
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:LoadParm_load_default",kwnames,&obj0)) SWIG_fail;
+  if (obj0) {
+    res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "LoadParm_load_default" "', argument " "1"" of type '" "loadparm_context *""'"); 
+    }
+    arg1 = (loadparm_context *)(argp1);
+  }
+  result = (bool)loadparm_context_load_default(arg1);
+  resultobj = SWIG_From_bool((bool)(result));
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_LoadParm___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   loadparm_context *arg1 = (loadparm_context *) 0 ;
@@ -4050,6 +4079,7 @@ SWIGINTERN PyObject *Swig_var_default_config_get(void) {
 static PyMethodDef SwigMethods[] = {
         { (char *)"new_LoadParm", (PyCFunction)_wrap_new_LoadParm, METH_NOARGS, NULL},
         { (char *)"LoadParm_load", (PyCFunction) _wrap_LoadParm_load, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"LoadParm_load_default", (PyCFunction) _wrap_LoadParm_load_default, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"LoadParm___len__", (PyCFunction) _wrap_LoadParm___len__, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"LoadParm___getitem__", (PyCFunction) _wrap_LoadParm___getitem__, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"LoadParm_configfile", (PyCFunction) _wrap_LoadParm_configfile, METH_VARARGS | METH_KEYWORDS, NULL},
index 9ea1c00dafc1d3ff261437a011437e729a1d7924..0dd186b9dfb1ed06befd74a3588b9b079ed05f08 100644 (file)
@@ -46,6 +46,9 @@ class LoadParmTestCase(unittest.TestCase):
         self.assertTrue(file.is_myname("BLA"))
         self.assertFalse(file.is_myname("FOOBAR"))
 
+    def test_load_default(self):
+        file = param.LoadParm()
+        file.load_default()
 
 class ParamTestCase(unittest.TestCase):
     def test_init(self):