details: http://www.bx.psu.edu/hg/galaxy/rev/0539d58e383a changeset: 3800:0539d58e383a user: jeremy goecks <jeremy.goecks@emory.edu> date: Fri May 21 14:41:20 2010 -0400 description: Enable display framework to handle unicode characters in item titles and enable pages to have unicode characters in titles. diffstat: lib/galaxy/web/controllers/page.py | 6 +++--- templates/display_common.mako | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 10 deletions(-) diffs (53 lines): diff -r e5bbcf6ebf6c -r 0539d58e383a lib/galaxy/web/controllers/page.py --- a/lib/galaxy/web/controllers/page.py Fri May 21 13:43:50 2010 -0400 +++ b/lib/galaxy/web/controllers/page.py Fri May 21 14:41:20 2010 -0400 @@ -296,8 +296,8 @@ return self.sharing( trans, **kwargs ) session.flush() - # Build grid - grid = self._page_list( trans, *args, **kwargs ) + # Build grid HTML and make sure to encode in utf-8 to support unicode characters. + grid = unicode( self._page_list( trans, *args, **kwargs ), 'utf-8' ) # Build list of pages shared with user. shared_by_others = trans.sa_session \ @@ -313,7 +313,7 @@ @web.expose def list_published( self, trans, *args, **kwargs ): - grid = self._all_published_list( trans, *args, **kwargs ) + grid = unicode( self._all_published_list( trans, *args, **kwargs ), 'utf-8' ) if 'async' in kwargs: return grid else: diff -r e5bbcf6ebf6c -r 0539d58e383a templates/display_common.mako --- a/templates/display_common.mako Fri May 21 13:43:50 2010 -0400 +++ b/templates/display_common.mako Fri May 21 14:41:20 2010 -0400 @@ -19,13 +19,19 @@ <%def name="get_item_name( item )"> <% # Start with exceptions, end with default. - if type( item ) is model.Page: - return item.title - elif type( item ) is model.Visualization: - return item.title - if hasattr( item, 'get_display_name'): - return item.get_display_name() - return item.name + if type( item ) is model.Page: + item_name = item.title + elif type( item ) is model.Visualization: + item_name = item.title + elif hasattr( item, 'get_display_name'): + item_name = item.get_display_name() + else: + item_name = item.name + + # Encode in unicode. + if type( item_name ) is str: + item_name = unicode( item_name, 'utf-8' ) + return item_name %> </%def>