Commit 14c9a64d authored by Nicolas Delaby's avatar Nicolas Delaby

Follow new index_html signature

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32061 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d06aebc1
...@@ -148,7 +148,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -148,7 +148,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
request = self.app.REQUEST request = self.app.REQUEST
# 1. Normal case: "my_title" field to the "my_title" reference in the ODF document # 1. Normal case: "my_title" field to the "my_title" reference in the ODF document
odf_document = foo_printout.index_html(REQUEST=request) odf_document = foo_printout.index_html(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -168,7 +168,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -168,7 +168,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 2. Normal case: change the field value and check again the ODF document # 2. Normal case: change the field value and check again the ODF document
test1.setTitle("Changed Title!") test1.setTitle("Changed Title!")
#foo_form.my_title.set_value('default', "Changed Title!") #foo_form.my_title.set_value('default', "Changed Title!")
odf_document = foo_printout.index_html(REQUEST=request) odf_document = foo_printout.index_html(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -180,7 +180,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -180,7 +180,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# rename id 'my_title' to 'xxx_title', then does not match in the ODF document # rename id 'my_title' to 'xxx_title', then does not match in the ODF document
foo_form = portal.foo_module.test1.Foo_view foo_form = portal.foo_module.test1.Foo_view
foo_form.manage_renameObject('my_title', 'xxx_title', REQUEST=request) foo_form.manage_renameObject('my_title', 'xxx_title', REQUEST=request)
odf_document = foo_printout.index_html(REQUEST=request) odf_document = foo_printout.index_html(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -195,7 +195,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -195,7 +195,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
foo_printout.template = None foo_printout.template = None
# template == None, causes a ValueError # template == None, causes a ValueError
try: try:
foo_printout.index_html(REQUEST=request) foo_printout.index_html(request)
except ValueError, e: except ValueError, e:
# 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)
...@@ -206,7 +206,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -206,7 +206,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 5. Normal case: just call a FormPrintout object # 5. Normal case: just call a FormPrintout object
request.RESPONSE.setHeader('Content-Type', 'text/html') request.RESPONSE.setHeader('Content-Type', 'text/html')
test1.setTitle("call!") test1.setTitle("call!")
odf_document = foo_printout() # call odf_document = foo_printout(request) # call
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -217,7 +217,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -217,7 +217,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 5. Normal case: utf-8 string # 5. Normal case: utf-8 string
test1.setTitle("Français") test1.setTitle("Français")
odf_document = foo_printout() odf_document = foo_printout(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -226,7 +226,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -226,7 +226,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 6. Normal case: unicode string # 6. Normal case: unicode string
test1.setTitle(u'Français test2') test1.setTitle(u'Français test2')
odf_document = foo_printout() odf_document = foo_printout(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -274,7 +274,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -274,7 +274,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
request = self.app.REQUEST request = self.app.REQUEST
# 1. Normal case: "my_title" field to the "my_title" reference in the ODF document # 1. Normal case: "my_title" field to the "my_title" reference in the ODF document
odf_document = foo_printout.index_html(REQUEST=request) odf_document = foo_printout.index_html(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
# validate the generated document # validate the generated document
self._validate(odf_document) self._validate(odf_document)
...@@ -303,6 +303,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -303,6 +303,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
form.ImageField form.ImageField
""" """
# create a new person # create a new person
request = self.portal.REQUEST
person_module = self.portal.getDefaultModule('Person') person_module = self.portal.getDefaultModule('Person')
if person_module._getOb('person1', None) is None: if person_module._getOb('person1', None) is None:
person_module.newContent(id='person1', portal_type='Person') person_module.newContent(id='person1', portal_type='Person')
...@@ -326,7 +327,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -326,7 +327,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
image_view_field.values['default'] = image.absolute_url_path() image_view_field.values['default'] = image.absolute_url_path()
# 01 - Normal image mapping # 01 - Normal image mapping
odf_document = foo_printout() odf_document = foo_printout(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
self._validate(odf_document) self._validate(odf_document)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
...@@ -355,7 +356,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -355,7 +356,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 02: No image defined # 02: No image defined
image_view_field.values['default'] = '' image_view_field.values['default'] = ''
odf_document = foo_printout() odf_document = foo_printout(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -398,7 +399,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -398,7 +399,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
request = self.app.REQUEST request = self.app.REQUEST
# 1. Normal case: "my_title" field to the "my_title" reference in the ODF document # 1. Normal case: "my_title" field to the "my_title" reference in the ODF document
odf_document = foo_printout.index_html(REQUEST=request) odf_document = foo_printout.index_html(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -418,7 +419,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -418,7 +419,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 2. Normal case: change the field value and check again the ODF document # 2. Normal case: change the field value and check again the ODF document
test1.setTitle("Changed Title!") test1.setTitle("Changed Title!")
#foo_form.my_title.set_value('default', "Changed Title!") #foo_form.my_title.set_value('default', "Changed Title!")
odf_document = foo_printout.index_html(REQUEST=request) odf_document = foo_printout.index_html(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -430,7 +431,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -430,7 +431,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# rename id 'my_title' to 'xxx_title', then does not match in the ODF document # rename id 'my_title' to 'xxx_title', then does not match in the ODF document
foo_form = portal.foo_module.test1.Foo_viewProxyField foo_form = portal.foo_module.test1.Foo_viewProxyField
foo_form.manage_renameObject('my_title', 'xxx_title', REQUEST=request) foo_form.manage_renameObject('my_title', 'xxx_title', REQUEST=request)
odf_document = foo_printout.index_html(REQUEST=request) odf_document = foo_printout.index_html(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -456,7 +457,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -456,7 +457,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 5. Normal case: just call a FormPrintout object # 5. Normal case: just call a FormPrintout object
request.RESPONSE.setHeader('Content-Type', 'text/html') request.RESPONSE.setHeader('Content-Type', 'text/html')
test1.setTitle("call!") test1.setTitle("call!")
odf_document = foo_printout() # call odf_document = foo_printout(request) # call
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -467,7 +468,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -467,7 +468,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 5. Normal case: utf-8 string # 5. Normal case: utf-8 string
test1.setTitle("Français") test1.setTitle("Français")
odf_document = foo_printout() odf_document = foo_printout(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -476,7 +477,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin): ...@@ -476,7 +477,7 @@ class TestFormPrintoutAsODG(TestFormPrintoutMixin):
# 6. Normal case: unicode string # 6. Normal case: unicode string
test1.setTitle(u'Français test2') test1.setTitle(u'Français test2')
odf_document = foo_printout() odf_document = foo_printout(request)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
......
...@@ -201,7 +201,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -201,7 +201,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
# 5. Normal case: just call a FormPrintout object # 5. Normal case: just call a FormPrintout object
request.RESPONSE.setHeader('Content-Type', 'text/html') request.RESPONSE.setHeader('Content-Type', 'text/html')
test1.setTitle("call!") test1.setTitle("call!")
odf_document = foo_printout() # call odf_document = foo_printout(request) # call
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -212,7 +212,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -212,7 +212,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
# 5. Normal case: utf-8 string # 5. Normal case: utf-8 string
test1.setTitle("Français") test1.setTitle("Français")
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -221,7 +221,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -221,7 +221,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
# 6. Normal case: unicode string # 6. Normal case: unicode string
test1.setTitle(u'Français test2') test1.setTitle(u'Français test2')
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -237,7 +237,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -237,7 +237,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
week = foo_form.week week = foo_form.week
week.values['default'] = ['line1', 'line2'] week.values['default'] = ['line1', 'line2']
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
#test_output = open("/tmp/test_01_Paragraph_07_LinesField.odf", "w") #test_output = open("/tmp/test_01_Paragraph_07_LinesField.odf", "w")
#test_output.write(odf_document) #test_output.write(odf_document)
...@@ -262,7 +262,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -262,7 +262,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
number.values['default'] = '543210' number.values['default'] = '543210'
# set a float field format # set a float field format
number.values['input_style'] = '-1 234.5' number.values['input_style'] = '-1 234.5'
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
#test_output = open("/tmp/test_01_Paragraph_08_Filed_Format.odf", "w") #test_output = open("/tmp/test_01_Paragraph_08_Filed_Format.odf", "w")
#test_output.write(odf_document) #test_output.write(odf_document)
...@@ -274,7 +274,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -274,7 +274,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
# change format # change format
number.values['input_style'] = '-1234.5' number.values['input_style'] = '-1234.5'
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -292,7 +292,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin): ...@@ -292,7 +292,7 @@ class TestFormPrintoutAsODT(TestFormPrintoutMixin):
test_title = foo_form.my_test_title test_title = foo_form.my_test_title
test_title.values['default'] = 'ZZZ test here ZZZ' test_title.values['default'] = 'ZZZ test here ZZZ'
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
#test_output = open("/tmp/test_01_Paragraph_09_RangeReferenceWithSpan.odf", "w") #test_output = open("/tmp/test_01_Paragraph_09_RangeReferenceWithSpan.odf", "w")
#test_output.write(odf_document) #test_output.write(odf_document)
...@@ -819,7 +819,7 @@ return report_section_list ...@@ -819,7 +819,7 @@ return report_section_list
form_name='FooReport_view', form_name='FooReport_view',
template='Foo2_getODTStyleSheet') template='Foo2_getODTStyleSheet')
self._validate(self.getODFDocumentFromPrintout(foo_report_printout)) self._validate(self.getODFDocumentFromPrintout(foo_report_printout))
odf_document = foo_report_printout() odf_document = foo_report_printout(self.portal.REQUEST)
#test_output = open("/tmp/test_04_Iteratoin.odf", "w") #test_output = open("/tmp/test_04_Iteratoin.odf", "w")
#test_output.write(odf_document) #test_output.write(odf_document)
...@@ -847,7 +847,7 @@ r""" ...@@ -847,7 +847,7 @@ r"""
return [] return []
""" """
) )
odf_document = foo_report_printout() odf_document = foo_report_printout(self.portal.REQUEST)
#test_output = open("/tmp/test_04_02_Iteratoin.odf", "w") #test_output = open("/tmp/test_04_02_Iteratoin.odf", "w")
#test_output.write(odf_document) #test_output.write(odf_document)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
...@@ -923,7 +923,7 @@ return report_section_list ...@@ -923,7 +923,7 @@ return report_section_list
form_name='FooReport_view', form_name='FooReport_view',
template='Foo3_getODTStyleSheet') template='Foo3_getODTStyleSheet')
self._validate(self.getODFDocumentFromPrintout(foo_report_printout)) self._validate(self.getODFDocumentFromPrintout(foo_report_printout))
odf_document = foo_report_printout() odf_document = foo_report_printout(self.portal.REQUEST)
#test_output = open("/tmp/test_04_Iteratoin_02_Section_01.odf", "w") #test_output = open("/tmp/test_04_Iteratoin_02_Section_01.odf", "w")
#test_output.write(odf_document) #test_output.write(odf_document)
...@@ -951,7 +951,7 @@ r""" ...@@ -951,7 +951,7 @@ r"""
return [] return []
""" """
) )
odf_document = foo_report_printout() odf_document = foo_report_printout(self.portal.REQUEST)
#test_output = open("/tmp/test_04_Iteratoin_02_Section_02.odf", "w") #test_output = open("/tmp/test_04_Iteratoin_02_Section_02.odf", "w")
#test_output.write(odf_document) #test_output.write(odf_document)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
...@@ -1035,7 +1035,7 @@ return report_section_list ...@@ -1035,7 +1035,7 @@ return report_section_list
form_name='Foo2_view', form_name='Foo2_view',
template='Foo4_getODTStyleSheet') template='Foo4_getODTStyleSheet')
self._validate(self.getODFDocumentFromPrintout(foo_report_printout)) self._validate(self.getODFDocumentFromPrintout(foo_report_printout))
odf_document = foo_report_printout() odf_document = foo_report_printout(self.portal.REQUEST)
# test_output = open("/tmp/test_04_Iteratoin_03_Section_01.odf", "w") # test_output = open("/tmp/test_04_Iteratoin_03_Section_01.odf", "w")
# test_output.write(odf_document) # test_output.write(odf_document)
...@@ -1063,7 +1063,7 @@ r""" ...@@ -1063,7 +1063,7 @@ r"""
return [] return []
""" """
) )
odf_document = foo_report_printout() odf_document = foo_report_printout(self.portal.REQUEST)
#test_output = open("/tmp/test_04_Iteratoin_02_Section_02.odf", "w") #test_output = open("/tmp/test_04_Iteratoin_02_Section_02.odf", "w")
#test_output.write(odf_document) #test_output.write(odf_document)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
...@@ -1110,7 +1110,7 @@ return [] ...@@ -1110,7 +1110,7 @@ return []
my_default_image_absolute_url.values['default'] = image.absolute_url_path() my_default_image_absolute_url.values['default'] = image.absolute_url_path()
# 01: Normal # 01: Normal
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -1128,7 +1128,7 @@ return [] ...@@ -1128,7 +1128,7 @@ return []
# 02: no image data # 02: no image data
my_default_image_absolute_url.values['default'] = '' my_default_image_absolute_url.values['default'] = ''
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self.assertTrue(odf_document is not None) self.assertTrue(odf_document is not None)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -1168,7 +1168,7 @@ return [] ...@@ -1168,7 +1168,7 @@ return []
checkbox = getattr(foo_form, field_name) checkbox = getattr(foo_form, field_name)
checkbox.values['default'] = 1 checkbox.values['default'] = 1
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self._validate(odf_document) self._validate(odf_document)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
...@@ -1177,7 +1177,7 @@ return [] ...@@ -1177,7 +1177,7 @@ return []
self.assertTrue(node.get('{%s}current-state' % document_tree.nsmap['form'])) self.assertTrue(node.get('{%s}current-state' % document_tree.nsmap['form']))
checkbox.values['default'] = 0 checkbox.values['default'] = 0
odf_document = foo_printout() odf_document = foo_printout(self.portal.REQUEST)
self._validate(odf_document) self._validate(odf_document)
builder = OOoBuilder(odf_document) builder = OOoBuilder(odf_document)
content_xml = builder.extract("content.xml") content_xml = builder.extract("content.xml")
......
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