Raise proper exceptions when lp file can't be found, be a
authorJelmer Vernooij <jelmer@samba.org>
Mon, 22 Dec 2008 05:34:18 +0000 (06:34 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 22 Dec 2008 05:34:18 +0000 (06:34 +0100)
bit less strict when no file was specified.

source4/param/pyparam.c

index 04bef072314f99d79945656dc87ac98b8e59bc63..0cf651dd7c66bc77f6b711c77fb68ef46ba24ef0 100644 (file)
@@ -317,6 +317,8 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj)
         lp_ctx = loadparm_init(NULL);
         if (!lp_load(lp_ctx, PyString_AsString(py_obj))) {
             talloc_free(lp_ctx);
+           PyErr_Format(PyExc_RuntimeError, 
+                        "Unable to load %s", PyString_AsString(py_obj));
             return NULL;
         }
         return lp_ctx;
@@ -324,10 +326,8 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj)
 
     if (py_obj == Py_None) {
         lp_ctx = loadparm_init(NULL);
-        if (!lp_load_default(lp_ctx)) {
-            talloc_free(lp_ctx);
-            return NULL;
-        }
+       /* We're not checking that loading the file succeeded *on purpose */
+        lp_load_default(lp_ctx);
         return lp_ctx;
     }