[Osaas-commits] r8 - in trunk: . server/osaas

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 28 12:46:24 CEST 2007


Author: bh
Date: 2007-08-28 12:46:24 +0200 (Tue, 28 Aug 2007)
New Revision: 8

Modified:
   trunk/ChangeLog
   trunk/server/osaas/config.py
Log:
* server/osaas/config.py (find_xml_path, find_xml_path_node)
(find_xml_path_text): Split find_xml_path into find_xml_path_node
and find_xml_path_text.
(read_config_file): Adapt to find_xml_path changes.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-08-27 17:51:26 UTC (rev 7)
+++ trunk/ChangeLog	2007-08-28 10:46:24 UTC (rev 8)
@@ -1,3 +1,10 @@
+2007-08-28  Bernhard Herzog  <bh at intevation.de>
+
+	* server/osaas/config.py (find_xml_path, find_xml_path_node)
+	(find_xml_path_text): Split find_xml_path into find_xml_path_node
+	and find_xml_path_text.
+	(read_config_file): Adapt to find_xml_path changes.
+
 2007-08-27  Bernhard Herzog  <bh at intevation.de>
 
 	* server/osaas/http/run.py (OptionStack.__init__): New parameter

Modified: trunk/server/osaas/config.py
===================================================================
--- trunk/server/osaas/config.py	2007-08-27 17:51:26 UTC (rev 7)
+++ trunk/server/osaas/config.py	2007-08-28 10:46:24 UTC (rev 8)
@@ -20,7 +20,7 @@
     pass
 
 
-def find_xml_path(node, path):
+def find_xml_path_node(node, path):
     for name in path.split("/"):
         children = [child for child in node.childNodes
                           if child.nodeName == name]
@@ -29,6 +29,12 @@
         if len(children) > 1:
             raise ConfigXMLPathError("More than one element matches %r" % path)
         node = children[0]
+    return node
+
+def find_xml_path_text(node, path):
+    node = find_xml_path_node(node, path)
+    if node is None:
+        return None
     node.normalize()
     value_node = node.firstChild
     if value_node.nodeType != value_node.TEXT_NODE:
@@ -40,7 +46,7 @@
     dom = parse(filename)
     for option in opts.option_list:
         if option.dest is not None and option.xml_path:
-            value = find_xml_path(dom, option.xml_path)
+            value = find_xml_path_text(dom, option.xml_path)
             if value is not None:
                 opts.set_file_option(option.dest,
                                      option.check_value(option.xml_path, value))



More information about the Osaas-commits mailing list