Commit bd2d9f1f authored by Tatuya Kamada's avatar Tatuya Kamada

Append __call__ method to the FormPrintout to invoke from python script


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26345 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 74cbe085
...@@ -183,6 +183,10 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item): ...@@ -183,6 +183,10 @@ class FormPrintout(Implicit, Persistent, RoleManager, Item):
'inline;filename="%s%s"' % (self.title_or_id(), guess_extension(content_type))) 'inline;filename="%s%s"' % (self.title_or_id(), guess_extension(content_type)))
return printout 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') security.declareProtected('Manage properties', 'doSettings')
def doSettings(self, REQUEST, title='', form_name='', template=''): def doSettings(self, REQUEST, title='', form_name='', template=''):
"""Change title, form_name, template.""" """Change title, form_name, template."""
......
...@@ -143,6 +143,7 @@ class TestFormPrintout(ERP5TypeTestCase): ...@@ -143,6 +143,7 @@ class TestFormPrintout(ERP5TypeTestCase):
## 4. False case: does not set a ODF template ## 4. False case: does not set a ODF template
self.assertTrue(foo_printout.template == 'Foo_getODTStyleSheet') self.assertTrue(foo_printout.template == 'Foo_getODTStyleSheet')
tmp_template = foo_printout.template
foo_printout.template = None foo_printout.template = None
# template == None, causes a ValueError # template == None, causes a ValueError
try: try:
...@@ -151,7 +152,17 @@ class TestFormPrintout(ERP5TypeTestCase): ...@@ -151,7 +152,17 @@ class TestFormPrintout(ERP5TypeTestCase):
# e -> 'Can not create a ODF Document without a odf_template' # e -> 'Can not create a ODF Document without a odf_template'
self.assertTrue(True) 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): def test_02_Table_01_Normal(self, run=run_all_test):
"""To test listbox and ODF table mapping """To test listbox and ODF table mapping
......
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