Add manual url links on table rows

svn: r13730
This commit is contained in:
Doug Blank
2009-12-06 15:57:53 +00:00
parent 6e8f40e9f2
commit 9fd2e4a7fc
2 changed files with 21 additions and 8 deletions

View File

@ -183,6 +183,7 @@ class SimpleTable(object):
def set_link_col(self, col):
"""
Manually sets the column that defines link.
col is either a number (column) or a (object_type_name, handle).
"""
self.__link_col = col
@ -313,12 +314,19 @@ class SimpleTable(object):
doc.start_row()
for col in row:
doc.start_cell('TableDataCell', span=1)
if self.__link[index]:
obj_type, handle = None, None
if isinstance(self.__link_col, tuple):
obj_type, handle = self.__link_col
elif self.__link[index]:
obj_type, handle = self.__link[index]
doc.start_link("/%s/%s" %
(obj_type.lower(), handle))
if obj_type:
if obj_type.lower() == "url":
doc.start_link(handle)
else:
doc.start_link("/%s/%s" %
(obj_type.lower(), handle))
doc.write_text(col, 'Normal')
if self.__link[index]:
if obj_type:
doc.stop_link()
doc.end_cell()
doc.end_row()