[Erp5-report] r26345 - in /erp5/trunk/products/ERP5OOo: ./ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Apr 8 09:42:57 CEST 2009
Author: tatuya
Date: Wed Apr 8 09:42:56 2009
New Revision: 26345
URL: http://svn.erp5.org?rev=26345&view=rev
Log:
Append __call__ method to the FormPrintout to invoke from python script
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=26345&r1=26344&r2=26345&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] Wed Apr 8 09:42:56 2009
@@ -183,6 +183,10 @@
'inline;filename="%s%s"' % (self.title_or_id(), guess_extension(content_type)))
return printout
+ security.declareProtected('View management screens', '__call__')
+ def __call__(self, *args, **kwargs):
+ return self.index_html(REQUEST=get_request())
+
security.declareProtected('Manage properties', 'doSettings')
def doSettings(self, REQUEST, title='', form_name='', template=''):
"""Change 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=26345&r1=26344&r2=26345&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] Wed Apr 8 09:42:56 2009
@@ -143,6 +143,7 @@
## 4. False case: does not set a ODF template
self.assertTrue(foo_printout.template == 'Foo_getODTStyleSheet')
+ tmp_template = foo_printout.template
foo_printout.template = None
# template == None, causes a ValueError
try:
@@ -151,7 +152,17 @@
# e -> 'Can not create a ODF Document without a odf_template'
self.assertTrue(True)
-
+ # put back
+ foo_printout.template = tmp_template
+
+ # 5. Normal case: just call a FormPrintout object
+ test1.setTitle("call!")
+ odf_document = foo_printout() # call
+ self.assertTrue(odf_document is not None)
+ builder = OOoBuilder(odf_document)
+ content_xml = builder.extract("content.xml")
+ self.assertTrue(content_xml.find("call!") > 0)
+
def test_02_Table_01_Normal(self, run=run_all_test):
"""To test listbox and ODF table mapping
More information about the Erp5-report
mailing list