Commit 037a7ed3 authored by Jérome Perrin's avatar Jérome Perrin

In development mode, validate the odf xml and LOG if it's not valid anytime we

render an OOoTemplate. This will help template authors to make valid openoffice
files.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19055 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6990374c
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
############################################################################## ##############################################################################
from types import StringType from types import StringType
from zLOG import LOG
from zLOG import PROBLEM
from Products.CMFCore.FSPageTemplate import FSPageTemplate from Products.CMFCore.FSPageTemplate import FSPageTemplate
from Products.CMFCore.DirectoryView import registerFileExtension, registerMetaType from Products.CMFCore.DirectoryView import registerFileExtension, registerMetaType
from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
...@@ -34,6 +36,7 @@ from Products.PageTemplates.PageTemplateFile import PageTemplateFile ...@@ -34,6 +36,7 @@ from Products.PageTemplates.PageTemplateFile import PageTemplateFile
from Products.ERP5Type import PropertySheet from Products.ERP5Type import PropertySheet
from urllib import quote from urllib import quote
from Globals import InitializeClass, DTMLFile, get_request from Globals import InitializeClass, DTMLFile, get_request
from Globals import DevelopmentMode
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from OOoUtils import OOoBuilder from OOoUtils import OOoBuilder
from zipfile import ZipFile, ZIP_DEFLATED from zipfile import ZipFile, ZIP_DEFLATED
...@@ -505,6 +508,14 @@ xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/> ...@@ -505,6 +508,14 @@ xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>
request.RESPONSE.setHeader('Content-Type','%s; charset=utf-8' % self.content_type) request.RESPONSE.setHeader('Content-Type','%s; charset=utf-8' % self.content_type)
request.RESPONSE.setHeader('Content-disposition', 'inline;filename=%s' % self.title_or_id()) request.RESPONSE.setHeader('Content-disposition', 'inline;filename=%s' % self.title_or_id())
if DevelopmentMode:
# Validate XML in development mode
from Products.ERP5OOo.tests.utils import Validator
err_list = Validator().validate(ooo)
if err_list:
LOG('ERP5OOo', PROBLEM,
'Validation of %s failed:\n%s' % (self.getId(), ''.join(err_list)))
return ooo return ooo
def om_icons(self): def om_icons(self):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment