[Mpuls-commits] r762 - in wasko/branches/2.0: . waskaweb/lib

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Jan 19 18:37:44 CET 2010


Author: bh
Date: 2010-01-19 18:37:43 +0100 (Tue, 19 Jan 2010)
New Revision: 762

Modified:
   wasko/branches/2.0/ChangeLog.txt
   wasko/branches/2.0/waskaweb/lib/config.py
Log:
* waskaweb/lib/config.py (MpulsConfig.__init__): Simplify
try-finally-block and improve logging


Modified: wasko/branches/2.0/ChangeLog.txt
===================================================================
--- wasko/branches/2.0/ChangeLog.txt	2010-01-19 17:31:26 UTC (rev 761)
+++ wasko/branches/2.0/ChangeLog.txt	2010-01-19 17:37:43 UTC (rev 762)
@@ -1,5 +1,10 @@
 2010-01-19  Bernhard Herzog  <bh at intevation.de>
 
+	* waskaweb/lib/config.py (MpulsConfig.__init__): Simplify
+	try-finally-block and improve logging
+
+2010-01-19  Bernhard Herzog  <bh at intevation.de>
+
 	* waskaweb/lib/app_globals.py (Globals.__init__): Better exception
 	logging.  Slightly better path handling due to configuration
 	improvements.

Modified: wasko/branches/2.0/waskaweb/lib/config.py
===================================================================
--- wasko/branches/2.0/waskaweb/lib/config.py	2010-01-19 17:31:26 UTC (rev 761)
+++ wasko/branches/2.0/waskaweb/lib/config.py	2010-01-19 17:37:43 UTC (rev 762)
@@ -52,15 +52,16 @@
 
         if filename and os.path.isfile(filename):
             try:
-                f = None
+                f = open(filename, "rb")
                 try:
-                    f = open(filename, "rb")
+                    log.info("Loading configfile: %s" % filename)
                     cfg = json.load(f)
+                    log.info("Loading OK")
                 finally:
-                    if f: f.close()
+                    f.close()
                 merge(self.config, cfg)
             except:
-                log.error("I/O error processing config file '%s'." % filename)
+                log.exception("error processing config file %r.", filename)
 
     def build_defaults(self):
         '''Set default configuration. This is function should be calles if



More information about the Mpuls-commits mailing list