[Erp5-report] r18924 - /erp5/trunk/products/ERP5Form/ScribusUtils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Jan 30 14:46:41 CET 2008


Author: fabien
Date: Wed Jan 30 14:46:40 2008
New Revision: 18924

URL: http://svn.erp5.org?rev=18924&view=rev
Log:
- add a code part to replace caracters from scribus file (.sla) wich are not
  xml valid and make xml parser failed to parse it. They appear for example 
  when you have more than one line in a text frame or if you have tabulation 
  caracter.
  This hack is temporary, because the problem comes with scribus and perhaps
  will be corrected in the next scribus version.

Modified:
    erp5/trunk/products/ERP5Form/ScribusUtils.py

Modified: erp5/trunk/products/ERP5Form/ScribusUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ScribusUtils.py?rev=18924&r1=18923&r2=18924&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ScribusUtils.py (original)
+++ erp5/trunk/products/ERP5Form/ScribusUtils.py Wed Jan 30 14:46:40 2008
@@ -1235,10 +1235,9 @@
     This function is used to get attributes'values in an object_dict and 
     to be sure a compatible value is returned (for that use default value)
     """
-    #return object_dict.get(check_key, None) or default_value
     if object_dict.has_key(check_key):
       # 'check_key' exists
-      if len(object_dict[check_key]) != 0:
+      if len(object_dict[check_key]):
         # check_key corresponding value is not null
         # returning this value
         return object_dict[check_key]
@@ -1260,6 +1259,15 @@
     a full dict of 'PAGE', containing a dict of 'PAGEOBJECT',
     containing a dict of all the relative attributes
     """
+
+    # XXX this is a hack to correct a scribus problem
+    # actualy scribus (version 1.3.3.12svn) use some invali xml caracters
+    # like the '' caracter wich is a carriage return caratere, used for
+    # example in a text frame with many lines
+    # this problem is well knowed by scribus community and perhaps will be
+    # correct in futur scribus version
+    xml_string = xml_string.replace('', '\n')
+    xml_string = xml_string.replace('', '\t')
 
     # Create DOM tree from the xml string
     print " > create DOM tree"
@@ -1351,7 +1359,7 @@
         # end parsing document version 1.2.*
 
       else:
-        print " found Scribus Doucment format 1.3"
+        print " found Scribus Doucment format 1.3 or higher"
         # assuming version is compliant with 1.3.* specifications
 
         keep_page = 1




More information about the Erp5-report mailing list