[Erp5-report] r26602 - in /erp5/trunk/products/ERP5OOo: ./ tests/
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Apr 23 10:02:17 CEST 2009
Author: tatuya
Date: Thu Apr 23 10:02:15 2009
New Revision: 26602
URL: http://svn.erp5.org?rev=26602&view=rev
Log:
just revert r26582
Modified:
erp5/trunk/products/ERP5OOo/FormPrintout.py
erp5/trunk/products/ERP5OOo/__init__.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=26602&r1=26601&r2=26602&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/FormPrintout.py [utf8] Thu Apr 23 10:02:15 2009
@@ -777,11 +777,6 @@
column.remove(child)
if first_child is not None:
column.append(first_child)
- # explicit table contents style setting
- if isinstance(value, PrintoutStyleCell) and value.getStyleName() is not None:
- style_attribute, original_style = self._getStyleAttributeTuple(first_child)
- if style_attribute is not None:
- first_child.set(style_attribute, value.getStyleName())
if column_value != '':
value_attribute = self._getColumnValueAttribute(column)
if value_attribute is not None:
@@ -810,17 +805,17 @@
column_children = column.getchildren()
for child in column_children:
# clear data except style
- style_attribute, style_value = self._getStyleAttributeTuple(child)
+ style_attribute_tuple = self._getStyleAttributeTuple(child)
child.clear()
- if style_attribute is not None:
- child.set(style_attribute, style_value)
+ if style_attribute_tuple is not None:
+ child.set(style_attribute_tuple[0], style_attribute_tuple[1])
def _getStyleAttributeTuple(self, element):
attrib = element.attrib
for key in attrib.keys():
if key.endswith('style-name'):
return (key, attrib[key])
- return (None, '')
+ return None
def _getColumnValueAttribute(self, column):
attrib = column.attrib
@@ -866,28 +861,3 @@
class ODTStrategy(ODFStrategy):
"""ODTStrategy create a ODT Document from a form and a ODT template"""
pass
-
-class PrintoutStyleCell:
- """setting a style name of a table-content explicitly
-
- Note: experimentally implementation
- """
- value = None
- style_name = None
-
- def __init__(self, value=None, style_name=None):
- self.value = value
- self.style_name = style_name
-
- def __call__(self):
- return self
-
- def __str__(self):
- if self.value is None: return ''
- elif isinstance(self.value, unicode) or isinstance(self.value, str):
- return self.value
- return str(self.value)
-
- def getStyleName(self):
- return self.style_name
-
Modified: erp5/trunk/products/ERP5OOo/__init__.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/__init__.py?rev=26602&r1=26601&r2=26602&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/__init__.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/__init__.py [utf8] Thu Apr 23 10:02:15 2009
@@ -43,8 +43,6 @@
ModuleSecurityInfo('Products.ERP5OOo.OOoUtils').declarePublic('OOoParser',)
ModuleSecurityInfo('Products.ERP5OOo.OOoUtils').declarePublic('newOOoParser',)
-ModuleSecurityInfo('Products.ERP5OOo.FormPrintout').declarePublic('PrintoutStyleCell',)
-
# Define object classes and tools
from OOoTemplate import OOoTemplate
from FormPrintout import FormPrintout
Modified: erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py?rev=26602&r1=26601&r2=26602&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testFormPrintout.py [utf8] Thu Apr 23 10:02:15 2009
@@ -578,76 +578,6 @@
# no rows
self.assertEqual(len(odf_table_rows), 0)
self._validate(odf_document)
-
- def test_02_Table_09_Explicit_Table_Content_Style(self, run=run_all_test):
- if not run: return
- # test target
- test1 = self.portal.foo_module.test1
- foo_printout = test1.Foo_viewAsPrintout
- foo_form = test1.Foo_view
- listbox = foo_form.listbox
- request = self.app.REQUEST
- request['here'] = test1
-
- foo_form.manage_renameObject('listbox', 'listbox2', REQUEST=request)
- listbox2 = foo_form.listbox2
- test1.foo_1.setTitle('foo_title_9')
- createZODBPythonScript(
- self.portal.portal_skins.custom,
- 'TestFoo_getFooWithStyleList',
- '*args,**kw',
-r"""
-from Products.ERP5OOo.FormPrintout import PrintoutStyleCell
-from Products.PythonScripts.standard import Object
-foo_list = context.objectValues(portal_type='Foo Line')
-foo_with_style_list = []
-for foo in foo_list:
- o = Object(uid='new_',
- id=foo.getId(),
- title=foo.getTitle(),
- quantity=PrintoutStyleCell(foo.getQuantity(), 'table-content-big') # explicit style
- )
- foo_with_style_list.append(o)
-return foo_with_style_list
-"""
- )
- message = listbox2.ListBox_setPropertyList(
- field_list_method = 'TestFoo_getFooWithStyleList',
- field_stat_method = 'portal_catalog',
- field_stat_columns = 'quantity | Foo_statQuantity',
- field_columns = 'id|ID\ntitle|Title\nquantity|Quantity',)
- self.failUnless('Set Successfully' in message)
- listboxline_list = listbox2.get_value('default', render_format = 'list',
- REQUEST = request)
- self.assertEqual(len(listboxline_list), 4)
- self.assertTrue(listboxline_list[1].getColumnProperty('title') == "foo_title_9")
-
- odf_document = foo_printout.index_html(REQUEST=request)
-
- self.assertTrue(odf_document is not None)
- test_output = open("/tmp/test_02_09_Table.odf", "w")
- test_output.write(odf_document)
- builder = OOoBuilder(odf_document)
- content_xml = builder.extract("content.xml")
-
- self.assertTrue(content_xml.find("foo_title_9") > 0)
-
- content = etree.XML(content_xml)
- table_row_xpath = '//table:table[@table:name="listbox2"]/table:table-row'
- odf_table_rows = content.xpath(table_row_xpath, namespaces=content.nsmap)
- self.assertEqual(len(odf_table_rows), 3)
- # to test explicit style name
- first_row = odf_table_rows[0]
- first_row_columns = first_row.getchildren()
- quantity_column = first_row_columns[2]
- quantity_paragraph = quantity_column.getchildren()[0]
- style_name_attrib = "{%s}style-name" % content.nsmap['text']
- self.assertTrue(quantity_paragraph.attrib.has_key(style_name_attrib))
- self.assertEqual(quantity_paragraph.attrib[style_name_attrib], 'table-content-big')
- self._validate(odf_document)
-
- # put back the field name
- foo_form.manage_renameObject('listbox2', 'listbox', REQUEST=request)
def _test_03_Frame(self, run=run_all_test):
"""
More information about the Erp5-report
mailing list