From c8e62797eb2b78427c9ecb193c878c646145c32a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 20 Dec 2009 17:49:48 +0100 Subject: Fix initialisation of TypeObject samba.param.LoadparmService. Found by Ricardo Jorge . --- source4/param/pyparam.c | 3 +++ source4/param/tests/bindings.py | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c index eb2da11bb0..b4255002d2 100644 --- a/source4/param/pyparam.c +++ b/source4/param/pyparam.c @@ -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; diff --git a/source4/param/tests/bindings.py b/source4/param/tests/bindings.py index 41a67f93fc..1915e79223 100644 --- a/source4/param/tests/bindings.py +++ b/source4/param/tests/bindings.py @@ -2,17 +2,17 @@ # Unix SMB/CIFS implementation. # Copyright (C) Jelmer Vernooij 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 . # @@ -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") -- cgit