Ticket #15692 (new Bug)
Plone Sitemap API returns nodes with mixed string and unicode 'Title' attributes
Reported by: | ajung | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 4.x |
Component: | Backend (Python) | Version: | 4.3 |
Keywords: | unicode, sitemap | Cc: |
Description (last modified by ajung) (diff)
We are using Plone 4.3 together with Dexterity-only content-types to generating a custom sitemap. We encountered the fact that some the 'Title' value of some nodes is sometimes utf-8 encoded and sometimes it is a unicode string...what a pain. As an API method this should really deliver strings in a consistent encoding - either unicode or utf-8 but not mixed...it is really a pita if you have to deal with such issues in your own code just becode the API method is doing bad or no checks at all.
def sitemap(self): pt = self.context.plone_utils sm = pt.createSitemap(self.context, self.request) data = list() data.append(u'<ul id="navigation-menu" class="level-1">') for node in sm['children']: self._print_sitemap(node, data, 1) data.append(u'</ul') return u'\n'.join(data)
Change History
Note: See
TracTickets for help on using
tickets.