6227: libhtml handles strings differently in python2.x and python3.x

svn: r20791
This commit is contained in:
Benny Malengier 2012-12-18 14:05:46 +00:00
parent 0e01b5919e
commit ef023ffdb3
2 changed files with 7 additions and 4 deletions

View File

@ -36,6 +36,7 @@ from __future__ import print_function
import re import re
import locale import locale
from gramps.gen.constfunc import STRTYPE
""" """
HTML operations. HTML operations.
@ -331,7 +332,8 @@ class Html(list):
:rtype: object reference :rtype: object reference
:returns: reference to object with new value added :returns: reference to object with new value added
""" """
if isinstance(value, Html) or not hasattr(value, '__iter__'): if isinstance(value, Html) or (not hasattr(value, '__iter__') and
not isinstance(value, STRTYPE)):
value = [value] value = [value]
index = len(self) - (1 if self.close else 0) index = len(self) - (1 if self.close else 0)
self[index:index] = value self[index:index] = value
@ -554,7 +556,8 @@ class Html(list):
""" """
if len(self) < 2: if len(self) < 2:
raise AttributeError('No closing tag. Cannot set inside value') raise AttributeError('No closing tag. Cannot set inside value')
if isinstance(value, Html) or not hasattr(value, '__iter__'): if isinstance(value, Html) or (not hasattr(value, '__iter__') and
not isinstance(value, STRTYPE)):
value = [value] value = [value]
self[1:-1] = value self[1:-1] = value
# #

View File

@ -4102,7 +4102,7 @@ class SourcePages(BasePage):
for item in self.report.obj_dict[Source].items(): for item in self.report.obj_dict[Source].items():
self.report.user.step_progress() self.report.user.step_progress()
self.SourcePage(self.report, title, item) self.SourcePage(self.report, title, item[0])
self.report.user.end_progress() self.report.user.end_progress()