[Erp5-report] r37870 yusei - /erp5/trunk/products/ERP5OOo/FormPrintout.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Aug 18 09:14:59 CEST 2010


Author: yusei
Date: Wed Aug 18 09:14:57 2010
New Revision: 37870

URL: http://svn.erp5.org?rev=37870&view=rev
Log:
Do nothing if form name space does not exist in element tree name
space dict, otherwise XPathEvalError occurs.

Modified:
    erp5/trunk/products/ERP5OOo/FormPrintout.py

Modified: erp5/trunk/products/ERP5OOo/FormPrintout.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/FormPrintout.py?rev=37870&r1=37869&r2=37870&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] Wed Aug 18 09:14:57 2010
@@ -979,6 +979,10 @@ class ODTStrategy(ODFStrategy):
     """
     field_id = field.id
     reference_xpath = '//*[@form:name = "%s"]' % field_id
+    # if form name space is not in the name space dict of element tree,
+    # it means that there is no form in the tree. Then do nothing and return.
+    if not 'form' in element_tree.nsmap:
+      return
     reference_list = element_tree.xpath(reference_xpath, namespaces=element_tree.nsmap)
     for target_node in reference_list:
       attr_dict = {}




More information about the Erp5-report mailing list