SVN: zpkgtools/trunk/zpkgtools/app.py clean up the error message provided when errors are found in a configuration

"Fred L. Drake, Jr." <[email protected]>
Newsgroups gmane.comp.web.zope.public-cvs
Message-ID <[email protected]>
Log message for revision 38144:
  clean up the error message provided when errors are found in a configuration
  file, so the user is presented with the error message and file location,
  but not a Python traceback
  

Changed:
  U   zpkgtools/trunk/zpkgtools/app.py

-=-
Modified: zpkgtools/trunk/zpkgtools/app.py
===================================================================
--- zpkgtools/trunk/zpkgtools/app.py	2005-08-29 16:51:44 UTC (rev 38143)
+++ zpkgtools/trunk/zpkgtools/app.py	2005-08-29 17:04:17 UTC (rev 38144)
@@ -23,6 +23,7 @@
 
 import zpkgtools
 
+from zpkgsetup import cfgparser
 from zpkgsetup import loggingapi as logging
 from zpkgsetup import package
 from zpkgsetup import publication
@@ -63,19 +64,20 @@
         location_maps = []
         for map in options.location_maps:
             if os.path.isfile(map):
-                map = os.path.abspath(map)
-                map = "file://" + urlutils.pathname2url(map)
+                map = urlutils.file_url(os.path.abspath(map))
             location_maps.append(map)
         cf.location_maps.extend(location_maps)
         path = options.configfile
         if path is None:
             path = config.defaultConfigurationPath()
-            if os.path.exists(path):
-                self.logger.debug("loading configuration file %s", path)
+            if not os.path.exists(path):
+                path = None
+        if path:
+            self.logger.debug("loading configuration file %s", path)
+            try:
                 cf.loadPath(path)
-        elif path:
-            self.logger.debug("loading configuration file %s", path)
-            cf.loadPath(path)
+            except cfgparser.ConfigurationError, e:
+                self.error(str(e))
         cf.finalize()
         self.locations = cf.locations
         if cf.collect_dependencies:

_______________________________________________
Zope-CVS maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zope-cvs

Zope CVS instructions: http://dev.zope.org/CVS
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.