Commit 955051f4 authored by Hugo H. Maia Vieira's avatar Hugo H. Maia Vieira

Re-add getColumnItemList and getLineItemList to granulate api


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@41810 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 61223b33
...@@ -123,6 +123,14 @@ class OOGranulate(object): ...@@ -123,6 +123,14 @@ class OOGranulate(object):
logger.error(e) logger.error(e)
return None return None
def getColumnItemList(self, file, table_id):
"""Return the list of columns in the form of (id, title)."""
raise NotImplementedError
def getLineItemList(self, file, table_id):
"""Returns the lines of a given table as (key, value) pairs."""
raise NotImplementedError
def getImageItemList(self): def getImageItemList(self):
"""Return a list of tuples with the id and title of image files""" """Return a list of tuples with the id and title of image files"""
xml_image_list = self.document.parsed_content.xpath(DRAW_XPATH_QUERY, xml_image_list = self.document.parsed_content.xpath(DRAW_XPATH_QUERY,
......
...@@ -38,6 +38,12 @@ class ITableGranulator(Interface): ...@@ -38,6 +38,12 @@ class ITableGranulator(Interface):
def getTableItem(id, format): def getTableItem(id, format):
"""Returns the table into a new 'format' file.""" """Returns the table into a new 'format' file."""
def getColumnItemList(file, table_id):
"""Return the list of columns in the form of (id, title)."""
def getLineItemList(file, table_id):
"""Returns the lines of a given table as (key, value) pairs."""
class IImageGranulator(Interface): class IImageGranulator(Interface):
"""Provides methods to granulate a document into images.""" """Provides methods to granulate a document into images."""
......
...@@ -57,6 +57,8 @@ class TestInterface(unittest.TestCase): ...@@ -57,6 +57,8 @@ class TestInterface(unittest.TestCase):
"""Test if OOGranulate implements ITableGranulator""" """Test if OOGranulate implements ITableGranulator"""
self.assertEquals(ITableGranulator.implementedBy(OOGranulate), True) self.assertEquals(ITableGranulator.implementedBy(OOGranulate), True)
method_list = ['getTableItem', method_list = ['getTableItem',
'getLineItemList',
'getColumnItemList',
'getTableItemList'] 'getTableItemList']
self.assertEquals(ITableGranulator.names(), method_list) self.assertEquals(ITableGranulator.names(), method_list)
......
...@@ -83,6 +83,18 @@ class TestOOGranulate(cloudoooTestCase): ...@@ -83,6 +83,18 @@ class TestOOGranulate(cloudoooTestCase):
table_data = oogranulate.getTableItem('NonExistentTable') table_data = oogranulate.getTableItem('NonExistentTable')
self.assertEquals(table_data, None) self.assertEquals(table_data, None)
def testGetColumnItemList(self):
"""Test if getColumnItemList() returns the right table columns list"""
self.assertRaises(NotImplementedError, self.oogranulate.getColumnItemList,
'file',
'table_id')
def testGetLineItemList(self):
"""Test if getLineItemList() returns the right table lines list"""
self.assertRaises(NotImplementedError, self.oogranulate.getLineItemList,
'file',
'table_id')
def testGetImageItemList(self): def testGetImageItemList(self):
"""Test if getImageItemList() returns the right images list""" """Test if getImageItemList() returns the right images list"""
image_list = self.oogranulate.getImageItemList() image_list = self.oogranulate.getImageItemList()
......
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