[Erp5-report] r24779 - /erp5/trunk/products/ERP5OOo/OOoUtils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Dec 3 14:22:58 CET 2008


Author: jerome
Date: Wed Dec  3 14:22:55 2008
New Revision: 24779

URL: http://svn.erp5.org?rev=24779&view=rev
Log:
use xpath and local-name() to get table:value-type or office:value-type, both
exists in ODF

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

Modified: erp5/trunk/products/ERP5OOo/OOoUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/OOoUtils.py?rev=24779&r1=24778&r2=24779&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/OOoUtils.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/OOoUtils.py [utf8] Wed Dec  3 14:22:55 2008
@@ -445,14 +445,19 @@
           for j in range(cells_to_repeat):
             # Get the cell content
             cell_data = None
-
-            value_type = cell.getAttributeNS(self.ns['office'], 'value-type')
+            
+            value_type = None
+            # value-type and value attributes can be in table or office
+            # namespaces, so we use local-name
+            value_type_attribute_list = cell.xpath('./@*[local-name()="value-type"]')
+            if value_type_attribute_list:
+              value_type = value_type_attribute_list[0].value
             if value_type == 'date':
-              cell_data = cell.getAttributeNS(self.ns['office'], 'date-value')
+              cell_data = cell.xpath('./@*[local-name()="date-value"]')[0].value
             elif value_type == 'time':
-              cell_data = cell.getAttributeNS(self.ns['office'], 'time-value')
+              cell_data = cell.xpath('./@*[local-name()="time-value"]')[0].value
             elif value_type in ('float', 'percentage', 'currency'):
-              cell_data = cell.getAttributeNS(self.ns['office'], 'value')
+              cell_data = cell.xpath('./@*[local-name()="value"]')[0].value
             else:
               text_tags = cell.xpath('.//*[name() = "text:p"]')
               if len(text_tags):




More information about the Erp5-report mailing list