[Erp5-report] r19750 - /erp5/trunk/products/ERP5OOo/OOoUtils.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Mar 7 11:17:46 CET 2008
Author: nicolas
Date: Fri Mar 7 11:17:45 2008
New Revision: 19750
URL: http://svn.erp5.org?rev=19750&view=rev
Log:
Declare zope namespaces with PyExpat API
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=19750&r1=19749&r2=19750&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/OOoUtils.py (original)
+++ erp5/trunk/products/ERP5OOo/OOoUtils.py Fri Mar 7 11:17:45 2008
@@ -168,15 +168,19 @@
reader = PyExpat.Reader()
document = reader.fromString(content_xml)
document_element = document.documentElement
+ tal = document.createAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:tal')
+ tal.value = u'http://xml.zope.org/namespaces/tal'
+ i18n = document.createAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:i18n')
+ i18n.value = u'http://xml.zope.org/namespaces/i18n'
+ metal = document.createAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:metal')
+ metal.value = u'http://xml.zope.org/namespaces/metal'
+ document_element.setAttributeNodeNS(tal)
+ document_element.setAttributeNodeNS(i18n)
+ document_element.setAttributeNodeNS(metal)
+ document_element.setAttribute('tal:attributes', 'dummy python:request.RESPONSE.setHeader("Content-Type", "text/html;; charset=utf-8")')
from xml.dom.ext import PrettyPrint
PrettyPrint(document_element, output)
- return output.getvalue().replace(
- "office:version='1.0'",
- """ xmlns:tal='http://xml.zope.org/namespaces/tal'
- xmlns:i18n='http://xml.zope.org/namespaces/i18n'
- xmlns:metal='http://xml.zope.org/namespaces/metal'
- tal:attributes='dummy python:request.RESPONSE.setHeader("Content-Type", "text/html;; charset=utf-8")'
- office:version='1.0'""")
+ return output.getvalue()
def addFileEntry(self, full_path, media_type, content=None):
""" Add a file entry to the manifest and possibly is content """
More information about the Erp5-report
mailing list