[Collab-qa-commits] r1037 - udd/src/udd

neronus-guest at alioth.debian.org neronus-guest at alioth.debian.org
Sat Aug 9 16:32:42 UTC 2008


Author: neronus-guest
Date: 2008-08-09 16:32:42 +0000 (Sat, 09 Aug 2008)
New Revision: 1037

Modified:
   udd/src/udd/aux.py
   udd/src/udd/packages_gatherer.py
   udd/src/udd/popcon_gatherer.py
   udd/src/udd/sources_gatherer.py
   udd/src/udd/upload_history_gatherer.py
Log:
Configuration checking is a little less ugly now


Modified: udd/src/udd/aux.py
===================================================================
--- udd/src/udd/aux.py	2008-08-09 16:23:35 UTC (rev 1036)
+++ udd/src/udd/aux.py	2008-08-09 16:32:42 UTC (rev 1037)
@@ -37,16 +37,9 @@
     raise ConfigException('general section not specified')
   
   general = config['general']
-
-  if not 'dbname' in general:
-    raise ConfigException('dbname not specified')
-
-  if not 'archs' in general:
-    raise ConfigException('archs not specified')
-
-  if not 'types' in general:
-    raise ConfigException('types not specified')
-
+  for k in ['dbname', 'archs', 'types']:
+    if not k in general:
+      raise ConfigException(k + ' not specified in node "general"')
   if not 'debug' in general:
     general['debug'] = 0
 

Modified: udd/src/udd/packages_gatherer.py
===================================================================
--- udd/src/udd/packages_gatherer.py	2008-08-09 16:23:35 UTC (rev 1036)
+++ udd/src/udd/packages_gatherer.py	2008-08-09 16:32:42 UTC (rev 1037)
@@ -1,5 +1,5 @@
 # /usr/bin/env python
-# Last-Modified: <Sat Aug  9 12:45:57 2008>
+# Last-Modified: <Sat 09 Aug 2008 18:30:18 CEST>
 # This file is a part of the Ultimate Debian Database project
 
 import debian_bundle.deb822
@@ -128,29 +128,9 @@
       raise ConfigException, "Source %s not specified" %(source)
     src_cfg = self.config[source]
 
-    if not 'directory' in src_cfg:
-      raise ConfigException('directory not specified for source %s' %
-	  (source))
+    for k in ['directory', 'archs', 'release', 'components', 'distribution', 'packages-table']:
+      raise ConfigException(k + ' not sepcified for source ' + source)
 
-    if not 'archs' in src_cfg:
-      raise ConfigException('archs not specified for source %s' %
-	  (source))
-
-    if not 'release' in src_cfg:
-      raise ConfigException('release not specified for source %s' %
-	  (source))
-
-    if not 'components' in src_cfg:
-      raise ConfigException('components not specified for source %s' %
-	  (source))
-
-    if not 'distribution' in src_cfg:
-      raise ConfigException('distribution not specified for source %s' %
-	  (source))
-
-    if not 'packages-table' in src_cfg:
-      raise ConfigException('packages-table not specified for source %s' % (source))
-
     aux.debug = self.config['general']['debug']
     table = src_cfg['packages-table']
 

Modified: udd/src/udd/popcon_gatherer.py
===================================================================
--- udd/src/udd/popcon_gatherer.py	2008-08-09 16:23:35 UTC (rev 1036)
+++ udd/src/udd/popcon_gatherer.py	2008-08-09 16:32:42 UTC (rev 1037)
@@ -24,15 +24,10 @@
     except:
       raise
 
-    if not 'path' in my_config:
-      raise aux.ConfigException, "path not configured for source " + source
+    for k in ['path', 'table', 'packages-table']:
+      raise ConfigException(k + ' not specified in ' + source)
 
-    if not 'table' in my_config:
-      raise aux.ConfigException, "table not configured for source " + source
 
-    if not 'packages-table' in my_config:
-      raise aux.ConfigException, "packages-table not configured for source " + source
-
     table = my_config['table']
     table_src = table + "_src"
     table_src_average = table + "_src_average"

Modified: udd/src/udd/sources_gatherer.py
===================================================================
--- udd/src/udd/sources_gatherer.py	2008-08-09 16:23:35 UTC (rev 1036)
+++ udd/src/udd/sources_gatherer.py	2008-08-09 16:32:42 UTC (rev 1037)
@@ -1,5 +1,5 @@
 #/usr/bin/env python
-# Last-Modified: <Sat Aug  9 12:05:42 2008>
+# Last-Modified: <Sat 09 Aug 2008 18:31:11 CEST>
 # This file is a part of the Ultimate Debian Database project
 
 import debian_bundle.deb822
@@ -101,25 +101,8 @@
       raise ConfigException, "Source %s not specified" %(src_name)
     src_cfg = self.config[source]
 
-    if not 'directory' in src_cfg:
-      raise ConfigException('directory not specified for source %s' %
-	  (src_name))
-
-    if not 'components' in src_cfg:
-      raise ConfigException('parts not specified for source %s' %
-	  (src_name))
-
-    if not 'distribution' in src_cfg:
-      raise ConfigException('distribution not specified for source in file %s' %
-	  (src_name))
-
-    if not 'release' in src_cfg:
-      raise ConfigException('release not specified for source %s' %
-	  (src_name))
-
-    if not 'sources-table' in src_cfg:
-      raise ConfigException('sources-table not specifed for source %s' %
-	  (src_name))
+    for k in ['directory', 'components', 'distribution', 'release', 'sources-table']:
+      raise ConfigException(k + ' not specified for source ' + source)
     
     table = src_cfg['sources-table']
 	

Modified: udd/src/udd/upload_history_gatherer.py
===================================================================
--- udd/src/udd/upload_history_gatherer.py	2008-08-09 16:23:35 UTC (rev 1036)
+++ udd/src/udd/upload_history_gatherer.py	2008-08-09 16:32:42 UTC (rev 1037)
@@ -1,4 +1,4 @@
-# Last-Modified: <Sat 09 Aug 2008 18:19:50 CEST>
+# Last-Modified: <Sat 09 Aug 2008 18:32:29 CEST>
 # This file is part of the Ultimate Debian Database Project
 
 from gatherer import gatherer




More information about the Collab-qa-commits mailing list