From d3e834cd817a3e46f241056f2617d24b76df97bf Mon Sep 17 00:00:00 2001 From: jimbiscuit Date: Wed, 10 Apr 2024 09:10:31 +0200 Subject: [PATCH 1/2] URB-3062. Fix column title format --- news/URB-3062.bugfix | 2 ++ src/Products/urban/browser/table/column.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 news/URB-3062.bugfix diff --git a/news/URB-3062.bugfix b/news/URB-3062.bugfix new file mode 100644 index 000000000..e2eddbd8c --- /dev/null +++ b/news/URB-3062.bugfix @@ -0,0 +1,2 @@ +Fix column title format +[jchandelle] \ No newline at end of file diff --git a/src/Products/urban/browser/table/column.py b/src/Products/urban/browser/table/column.py index 3fa55fec7..8091e374f 100644 --- a/src/Products/urban/browser/table/column.py +++ b/src/Products/urban/browser/table/column.py @@ -116,7 +116,7 @@ def renderTitleLink(self, urbanlist_item): title_words.insert(15 * (split + 1), "
") title = " ".join(title_words) - title = '%s' % (url, css_class, title) + title = '{}'.format(url, css_class, title) return title def renderCell(self, urbanlist_item): @@ -236,7 +236,7 @@ def render(self): if tel: address = "%s
%s" % (address, tel) - title = "%s%s" % (title, address) + title = "{}{}".format(title, address) return title From cd39fb1dc9be0eabde9148f9e8ecd91498b0a634 Mon Sep 17 00:00:00 2001 From: jimbiscuit Date: Tue, 3 Dec 2024 14:01:12 +0100 Subject: [PATCH 2/2] URB-3062 Change format to safe_unicode --- src/Products/urban/browser/table/column.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Products/urban/browser/table/column.py b/src/Products/urban/browser/table/column.py index 8091e374f..d62504b43 100644 --- a/src/Products/urban/browser/table/column.py +++ b/src/Products/urban/browser/table/column.py @@ -13,6 +13,7 @@ from zope.component import queryMultiAdapter from zope.interface import implements from zope.i18n import translate +from Products.CMFPlone.utils import safe_unicode from Products.urban.setuphandlers import _ as _t from Products.urban.browser.table.interfaces import ( @@ -116,7 +117,9 @@ def renderTitleLink(self, urbanlist_item): title_words.insert(15 * (split + 1), "
") title = " ".join(title_words) - title = '{}'.format(url, css_class, title) + title = '%s' % ( + safe_unicode(url), safe_unicode(css_class), safe_unicode(title) + ) return title def renderCell(self, urbanlist_item): @@ -128,7 +131,7 @@ def renderCell(self, urbanlist_item): title = adapter.render() else: title = self.renderTitleLink(urbanlist_item) - return title.decode("utf-8") + return safe_unicode(title) def getSortKey(self, urbanlist_item): return urbanlist_item.Title() @@ -236,7 +239,7 @@ def render(self): if tel: address = "%s
%s" % (address, tel) - title = "{}{}".format(title, address) + title = "%s%s" % (safe_unicode(title), safe_unicode(address)) return title