Fix initialisation of TypeObject samba.param.LoadparmService.
authorJelmer Vernooij <jelmer@samba.org>
Sun, 20 Dec 2009 16:49:48 +0000 (17:49 +0100)
committerJelmer Vernooij <jelmer@ganieda.vernstok.nl>
Mon, 21 Dec 2009 22:40:11 +0000 (23:40 +0100)
Found by Ricardo Jorge <rvelhote@gmail.com>.

source4/param/pyparam.c
source4/param/tests/bindings.py

index eb2da11bb03e20c4da1db755c754a4f501ffafc5..b4255002d27abac055425ca5b7b76f501ca69060 100644 (file)
@@ -374,6 +374,9 @@ void initparam(void)
        if (PyType_Ready(&PyLoadparmContext) < 0)
                return;
 
+       if (PyType_Ready(&PyLoadparmService) < 0)
+               return;
+
        m = Py_InitModule3("param", pyparam_methods, "Parsing and writing Samba configuration files.");
        if (m == NULL)
                return;
index 41a67f93fc8f2a0f414b139e594c7fa1b7a11fdd..1915e79223a637aafaaf392008505922ddd5f109 100644 (file)
@@ -2,17 +2,17 @@
 
 # Unix SMB/CIFS implementation.
 # Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
-#   
+#
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-#   
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-#   
+#
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 #
@@ -50,3 +50,7 @@ class LoadParmTestCase(unittest.TestCase):
         file = param.LoadParm()
         file.load_default()
 
+    def test_section_nonexistant(self):
+        samba_lp = param.LoadParm()
+        samba_lp.load_default()
+        self.assertRaises(KeyError, samba_lp.__getitem__, "nonexistant")