[Erp5-report] r26363 - in /erp5/trunk/products/ERP5OOo: ./ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Apr 9 07:40:29 CEST 2009
Author: tatuya
Date: Thu Apr 9 07:40:28 2009
New Revision: 26363
URL: http://svn.erp5.org?rev=26363&view=rev
Log:
* Fix
- set 'View' permission to index_html method as well as r26362
- when just call FormPrintout from Python script or python code,
must not set RESPONSE headers
Modified:
erp5/trunk/products/ERP5OOo/FormPrintout.py
erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py
Modified: erp5/trunk/products/ERP5OOo/FormPrintout.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/FormPrintout.py?rev=26363&r1=26362&r2=26363&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] Thu Apr 9 07:40:28 2009
@@ -150,7 +150,7 @@
self.form_name = form_name
self.template = template
- security.declareProtected('View management screens', 'index_html')
+ security.declareProtected('View', 'index_html')
def index_html(self, icon=0, preview=0, width=None, height=None, REQUEST=None):
"""Render and view a printout document."""
@@ -178,14 +178,14 @@
content_type = printout_template.content_type
self.strategy = self._createStrategy(content_type)
printout = self.strategy.render(extra_context=extra_context)
- REQUEST.RESPONSE.setHeader('Content-Type','%s; charset=utf-8' % content_type)
- REQUEST.RESPONSE.setHeader('Content-disposition',
- 'inline;filename="%s%s"' % (self.title_or_id(), guess_extension(content_type)))
+ if REQUEST is not None:
+ REQUEST.RESPONSE.setHeader('Content-Type','%s; charset=utf-8' % content_type)
+ REQUEST.RESPONSE.setHeader('Content-disposition',
+ 'inline;filename="%s%s"' % (self.title_or_id(), guess_extension(content_type)))
return printout
- security.declareProtected('View', '__call__')
- def __call__(self, *args, **kwargs):
- return self.index_html(REQUEST=get_request())
+ security.declareProtected('View', '__call__')
+ __call__ = index_html
security.declareProtected('Manage properties', 'doSettings')
def doSettings(self, REQUEST, title='', form_name='', template=''):
Modified: erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py?rev=26363&r1=26362&r2=26363&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] Thu Apr 9 07:40:28 2009
@@ -162,6 +162,8 @@
builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml")
self.assertTrue(content_xml.find("call!") > 0)
+ # when just call FormPrintout, it does not set content-type
+ self.assertEqual(request.RESPONSE.getHeader('Content-Type'), None)
# 5. Normal case: utf-8 string
test1.setTitle("Français")
More information about the Erp5-report
mailing list