Skip to content

Commit

Permalink
[#54] Fix crash when page title in menu contains Unicode
Browse files Browse the repository at this point in the history
  • Loading branch information
torfsen committed Sep 27, 2017
1 parent b5ec387 commit 6d57909
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ckanext/pages/plugin.py
Expand Up @@ -47,11 +47,9 @@ def build_pages_nav_main(*args):
page_name = p.toolkit.c.environ['routes.url'].current().split('/')[-1]

for page in pages_list:
if page['page_type'] == 'blog':
link = h.literal('<a href="/blog/%s">%s</a>' % (str(page['name']), str(page['title'])))
else:
link = h.literal('<a href="/pages/%s">%s</a>' % (str(page['name']), str(page['title'])))

page_type = 'blog' if page['page_type'] == 'blog' else 'pages'
link = h.literal(u'<a href="/{}/{}">{}</a>'.format(page_type,
page['name'], page['title']))
if page['name'] == page_name:
li = h.literal('<li class="active">') + link + h.literal('</li>')
else:
Expand Down

0 comments on commit 6d57909

Please sign in to comment.