[Mpuls-commits] r1568 - in wasko/branches/2.0: . mpulsweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 15 17:24:50 CET 2010


Author: bh
Date: 2010-02-15 17:24:49 +0100 (Mon, 15 Feb 2010)
New Revision: 1568

Modified:
   wasko/branches/2.0/ChangeLog
   wasko/branches/2.0/mpulsweb/lib/config.py
Log:
* mpulsweb/lib/config.py (MpulsConfig.__init__): Do not catch
errors raised when the json file cannot be loaded.  If it cannot
be loaded, the application will not work correctly anyway, so it's
better to fail early and noisily.


Modified: wasko/branches/2.0/ChangeLog
===================================================================
--- wasko/branches/2.0/ChangeLog	2010-02-15 15:37:12 UTC (rev 1567)
+++ wasko/branches/2.0/ChangeLog	2010-02-15 16:24:49 UTC (rev 1568)
@@ -1,3 +1,10 @@
+2010-02-15  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/lib/config.py (MpulsConfig.__init__): Do not catch
+	errors raised when the json file cannot be loaded.  If it cannot
+	be loaded, the application will not work correctly anyway, so it's
+	better to fail early and noisily.
+
 2010-02-15  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* waskaweb/controllers/case.py: Import CaseAppointmentFactory from

Modified: wasko/branches/2.0/mpulsweb/lib/config.py
===================================================================
--- wasko/branches/2.0/mpulsweb/lib/config.py	2010-02-15 15:37:12 UTC (rev 1567)
+++ wasko/branches/2.0/mpulsweb/lib/config.py	2010-02-15 16:24:49 UTC (rev 1568)
@@ -52,17 +52,14 @@
         self.config = self.build_defaults()
 
         if filename and os.path.isfile(filename):
+            f = open(filename, "rb")
             try:
-                f = open(filename, "rb")
-                try:
-                    log.info("Loading configfile: %s" % filename)
-                    cfg = json.load(f)
-                    log.info("Loading OK")
-                finally:
-                    f.close()
-                merge(self.config, cfg)
-            except:
-                log.exception("error processing config file %r.", filename)
+                log.info("Loading configfile: %s" % filename)
+                cfg = json.load(f)
+                log.info("Loading OK")
+            finally:
+                f.close()
+            merge(self.config, cfg)
 
     def build_defaults(self):
         '''Set default configuration. This is function should be calles if



More information about the Mpuls-commits mailing list