[hg] galaxy 3315: Map end-of-line chars so they can be correctly...
details: http://www.bx.psu.edu/hg/galaxy/rev/ac6e08aed7d4 changeset: 3315:ac6e08aed7d4 user: Greg Von Kuster <greg@bx.psu.edu> date: Tue Feb 02 12:23:50 2010 -0500 description: Map end-of-line chars so they can be correctly stored in the db and displayed in form fields. Fix library formfields to convert end-of-line chars to html. diffstat: lib/galaxy/util/__init__.py | 4 +++- templates/library/common/common.mako | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diffs (41 lines): diff -r 050b4ced619f -r ac6e08aed7d4 lib/galaxy/util/__init__.py --- a/lib/galaxy/util/__init__.py Mon Feb 01 16:30:33 2010 -0500 +++ b/lib/galaxy/util/__init__.py Tue Feb 02 12:23:50 2010 -0500 @@ -120,7 +120,9 @@ ']' :'__cb__', '{' :'__oc__', '}' :'__cc__', - '@' : '__at__' + '@' : '__at__', + '\n' : '__cn__', + '\r' : '__cr__' } def restore_text(text): diff -r 050b4ced619f -r ac6e08aed7d4 templates/library/common/common.mako --- a/templates/library/common/common.mako Mon Feb 01 16:30:33 2010 -0500 +++ b/templates/library/common/common.mako Tue Feb 02 12:23:50 2010 -0500 @@ -36,9 +36,22 @@ %else: %for i, field in enumerate( widgets ): %if field[ 'widget' ].value: + <% + val = field[ 'widget' ].value + # Change new line chars to html + if val.find( '\r\n' ) >= 0: + val = val.replace( '\r\n', '<br/>' ) + if val.find( '\r' ) >= 0: + val = val.replace( '\r', '<br/>' ) + if val.find( '\n' ) >= 0: + val = val.replace( '\n', '<br/>' ) + # Convert to unicode to display non-ascii characters. + if type( val ) is not unicode: + val = unicode( val, 'utf-8' ) + %> <div class="form-row"> <label>${field[ 'label' ]}</label> - ${field[ 'widget' ].value} + ${val} <div class="toolParamHelp" style="clear: both;"> ${field[ 'helptext' ]} </div>
participants (1)
-
Greg Von Kuster