lists.galaxyproject.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
List overview
Download
galaxy-commits
December 2012
----- 2024 -----
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
galaxy-commits@lists.galaxyproject.org
1 participants
142 discussions
Start a n
N
ew thread
commit/galaxy-central: greg: Clean up page content rendering in the tool shed.
by Bitbucket
03 Dec '12
03 Dec '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/cdbee5bc4a6d/
changeset: cdbee5bc4a6d user: greg date: 2012-12-03 15:31:52 summary: Clean up page content rendering in the tool shed. affected #: 7 files diff -r 20a25a4f989d034c6be371ffa90947c8dc0269d3 -r cdbee5bc4a6d2140401ba0ab1ce7de3e9b9882b0 lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -19,6 +19,9 @@ from elementtree import ElementTree, ElementInclude from elementtree.ElementTree import Element, SubElement +eggs.require( 'markupsafe' ) +import markupsafe + log = logging.getLogger( __name__ ) INITIAL_CHANGELOG_HASH = '000000000000' @@ -1155,20 +1158,20 @@ return all_repository_dependencies def get_repository_file_contents( file_path ): if is_gzip( file_path ): - safe_str = to_safe_str( '\ngzip compressed file\n' ) + safe_str = to_safe_string( '\ngzip compressed file\n' ) elif is_bz2( file_path ): - safe_str = to_safe_str( '\nbz2 compressed file\n' ) + safe_str = to_safe_string( '\nbz2 compressed file\n' ) elif check_zip( file_path ): - safe_str = to_safe_str( '\nzip compressed file\n' ) + safe_str = to_safe_string( '\nzip compressed file\n' ) elif check_binary( file_path ): - safe_str = to_safe_str( '\nBinary file\n' ) + safe_str = to_safe_string( '\nBinary file\n' ) else: safe_str = '' for i, line in enumerate( open( file_path ) ): - safe_str = '%s%s' % ( safe_str, to_safe_str( line ) ) + safe_str = '%s%s' % ( safe_str, to_safe_string( line ) ) if len( safe_str ) > MAX_CONTENT_SIZE: large_str = '\nFile contents truncated because file size is larger than maximum viewing size of %s\n' % util.nice_size( MAX_CONTENT_SIZE ) - safe_str = '%s%s' % ( safe_str, to_safe_str( large_str ) ) + safe_str = '%s%s' % ( safe_str, to_safe_string( large_str ) ) break return safe_str def get_repository_files( trans, folder_path ): @@ -1631,7 +1634,7 @@ except: file_name = fpath return file_name -def to_safe_str( text, to_html=True ): +def to_safe_string( text, to_html=True ): """Translates the characters in text to an html string""" translated = [] for c in text: @@ -1639,25 +1642,29 @@ translated.append( c ) elif c in MAPPED_CHARS: translated.append( MAPPED_CHARS[ c ] ) - elif c in [ '\n', '\r' ]: + elif c in [ '\n' ]: if to_html: translated.append( '<br/>' ) else: translated.append( c ) + elif c in [ '\r' ]: + continue elif c in [ ' ', ' ' ]: translated.append( c ) else: translated.append( '' ) + if to_html: + str( markupsafe.escape( ''.join( translated ) ) ) return ''.join( translated ) def tool_shed_is_this_tool_shed( toolshed_base_url ): return toolshed_base_url.rstrip( '/' ) == str( url_for( '/', qualified=True ) ).rstrip( '/' ) def translate_string( raw_text, to_html=True ): if raw_text: if len( raw_text ) <= MAX_CONTENT_SIZE: - translated_string = to_safe_str( raw_text, to_html=to_html ) + translated_string = to_safe_string( raw_text, to_html=to_html ) else: large_str = '\nFile contents truncated because file size is larger than maximum viewing size of %s\n' % util.nice_size( MAX_CONTENT_SIZE ) - translated_string = to_safe_str( '%s%s' % ( raw_text[ 0:MAX_CONTENT_SIZE ], large_str ), to_html=to_html ) + translated_string = to_safe_string( '%s%s' % ( raw_text[ 0:MAX_CONTENT_SIZE ], large_str ), to_html=to_html ) else: translated_string = '' return translated_string diff -r 20a25a4f989d034c6be371ffa90947c8dc0269d3 -r cdbee5bc4a6d2140401ba0ab1ce7de3e9b9882b0 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -2263,17 +2263,6 @@ if list: return ','.join( list ) return '' - def to_html_escaped( self, text ): - """Translates the characters in text to html values""" - translated = [] - for c in text: - if c in [ '\r\n', '\n', ' ', '\t' ] or c in VALID_CHARS: - translated.append( c ) - elif c in MAPPED_CHARS: - translated.append( MAPPED_CHARS[ c ] ) - else: - translated.append( '' ) - return ''.join( translated ) def __validate_repository_name( self, name, user ): # Repository names must be unique for each user, must be at least four characters # in length and must contain only lower-case letters, numbers, and the '_' character. @@ -2347,7 +2336,7 @@ anchors = modified + added + removed + deleted + unknown + ignored + clean diffs = [] for diff in patch.diff( repo, node1=ctx_parent.node(), node2=ctx.node() ): - diffs.append( self.to_html_escaped( diff ) ) + diffs.append( to_safe_string( diff, to_html=True ) ) is_malicious = changeset_is_malicious( trans, id, repository.tip( trans.app ) ) metadata = self.get_metadata( trans, id, ctx_str ) return trans.fill_template( '/webapps/community/repository/view_changeset.mako', diff -r 20a25a4f989d034c6be371ffa90947c8dc0269d3 -r cdbee5bc4a6d2140401ba0ab1ce7de3e9b9882b0 templates/webapps/community/common/common.mako --- a/templates/webapps/community/common/common.mako +++ b/templates/webapps/community/common/common.mako @@ -31,16 +31,6 @@ </script></%def> -<%def name="escape_html_add_breaks( value )"> - <% - from galaxy import eggs - eggs.require('markupsafe') - import markupsafe - value = str( markupsafe.escape( value ) ).replace( '\n', '<br/>' ) - %> - ${value} -</%def> - <%def name="render_star_rating( name, rating, disabled=False )"><% if disabled: @@ -71,7 +61,7 @@ <div class="form-row"><label>Detailed description:</label><table id="description_table"> - <tr><td>${ escape_html_add_breaks( description_text ) }</td></tr> + <tr><td>${description_text}</td></tr></table><div style="clear: both"></div></div> diff -r 20a25a4f989d034c6be371ffa90947c8dc0269d3 -r cdbee5bc4a6d2140401ba0ab1ce7de3e9b9882b0 templates/webapps/community/repository/common.mako --- a/templates/webapps/community/repository/common.mako +++ b/templates/webapps/community/repository/common.mako @@ -1,4 +1,3 @@ -<%namespace file="/webapps/community/common/common.mako" import="escape_html_add_breaks" /><%def name="common_javascripts(repository)"><script type="text/javascript"> @@ -316,14 +315,17 @@ </%def><%def name="render_readme( readme, pad, parent, row_counter )"> - <% encoded_id = trans.security.encode_id( readme.id ) %> + <% + from galaxy.util.shed_util_common import to_safe_string + encoded_id = trans.security.encode_id( readme.id ) + %><tr class="datasetRow" %if parent is not None: parent="${parent}" %endif id="libraryItem-${encoded_id}"><td style="padding-left: ${pad+20}px;"> - ${escape_html_add_breaks( readme.text )} + ${ to_safe_string( readme.text, to_html=True ) } </td></tr><% diff -r 20a25a4f989d034c6be371ffa90947c8dc0269d3 -r cdbee5bc4a6d2140401ba0ab1ce7de3e9b9882b0 templates/webapps/community/repository/view_changeset.mako --- a/templates/webapps/community/repository/view_changeset.mako +++ b/templates/webapps/community/repository/view_changeset.mako @@ -185,7 +185,7 @@ ctr += 1 %><tr><td bgcolor="#E0E0E0">${anchor_str}</td></tr> - <tr><td>${ escape_html_add_breaks( diff ) }</td></tr> + <tr><td>${diff}</td></tr> %endfor </table></div> diff -r 20a25a4f989d034c6be371ffa90947c8dc0269d3 -r cdbee5bc4a6d2140401ba0ab1ce7de3e9b9882b0 templates/webapps/community/repository/view_repository.mako --- a/templates/webapps/community/repository/view_repository.mako +++ b/templates/webapps/community/repository/view_repository.mako @@ -5,6 +5,7 @@ <% from galaxy.web.framework.helpers import time_ago + from galaxy.util.shed_util_common import to_safe_string has_readme = metadata and 'readme' in metadata has_metadata = repository.metadata_revisions @@ -157,7 +158,7 @@ ${repository.description | h} </div> %if repository.long_description: - ${render_long_description( repository.long_description )} + ${render_long_description( to_safe_string( repository.long_description, to_html=True ) )} %endif <div class="form-row"><label>Revision:</label> diff -r 20a25a4f989d034c6be371ffa90947c8dc0269d3 -r cdbee5bc4a6d2140401ba0ab1ce7de3e9b9882b0 templates/webapps/community/repository_review/browse_review.mako --- a/templates/webapps/community/repository_review/browse_review.mako +++ b/templates/webapps/community/repository_review/browse_review.mako @@ -5,6 +5,7 @@ <% from galaxy.web.form_builder import CheckboxField from galaxy.webapps.community.util.container_util import STRSEP + from galaxy.util.shed_util_common import to_safe_string can_manage_repository = is_admin or repository.user == trans.user %> @@ -93,7 +94,7 @@ <tr><td><div overflow-wrap:normal;overflow:hidden;word-break:keep-all;word-wrap:break-word;line-break:strict;> - ${ escape_html_add_breaks( component_review.comment ) } + ${ to_safe_string( component_review.comment, to_html=True ) } </div></td></tr> Repository URL:
https://bitbucket.org/galaxy/galaxy-central/
-- This is a commit notification from
bitbucket.org
. You are receiving this because you have the service enabled, addressing the recipient of this email.
1
0
0
0
commit/galaxy-central: greg: Fixes for rendering certain tool shed repository content.
by Bitbucket
01 Dec '12
01 Dec '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/20a25a4f989d/
changeset: 20a25a4f989d user: greg date: 2012-12-01 01:37:37 summary: Fixes for rendering certain tool shed repository content. affected #: 2 files diff -r 03ec137ca8a3148aa771769e80963b65194b7895 -r 20a25a4f989d034c6be371ffa90947c8dc0269d3 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -1064,19 +1064,6 @@ return removed, error_message def tool_shed_from_repository_clone_url( repository_clone_url ): return clean_repository_clone_url( repository_clone_url ).split( 'repos' )[ 0 ].rstrip( '/' ) -def translate_string( raw_text, to_html=True ): - if raw_text: - if to_html: - if len( raw_text ) <= MAX_CONTENT_SIZE: - translated_string = to_html_str( raw_text ) - else: - large_str = '\nFile contents truncated because file size is larger than maximum viewing size of %s\n' % util.nice_size( MAX_CONTENT_SIZE ) - translated_string = to_html_str( '%s%s' % ( raw_text[ 0:MAX_CONTENT_SIZE ], large_str ) ) - else: - raise Exception( "String translation currently only supports text to HTML." ) - else: - translated_string = '' - return translated_string def update_in_shed_tool_config( app, repository ): # A tool shed repository is being updated so change the shed_tool_conf file. Parse the config file to generate the entire list # of config_elems instead of using the in-memory list. diff -r 03ec137ca8a3148aa771769e80963b65194b7895 -r 20a25a4f989d034c6be371ffa90947c8dc0269d3 lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -62,7 +62,7 @@ f = open( full_path_to_readme_file, 'r' ) text = f.read() f.close() - readme_files_dict[ readme_file_name ] = str( text ) + readme_files_dict[ readme_file_name ] = translate_string( text, to_html=False ) except Exception, e: log.debug( "Error reading README file '%s' defined in metadata for repository '%s', revision '%s': %s" % \ ( str( relative_path_to_readme_file ), str( repository_name ), str( changeset_revision ), str( e ) ) ) @@ -1155,22 +1155,22 @@ return all_repository_dependencies def get_repository_file_contents( file_path ): if is_gzip( file_path ): - to_html = to_html_str( '\ngzip compressed file\n' ) + safe_str = to_safe_str( '\ngzip compressed file\n' ) elif is_bz2( file_path ): - to_html = to_html_str( '\nbz2 compressed file\n' ) + safe_str = to_safe_str( '\nbz2 compressed file\n' ) elif check_zip( file_path ): - to_html = to_html_str( '\nzip compressed file\n' ) + safe_str = to_safe_str( '\nzip compressed file\n' ) elif check_binary( file_path ): - to_html = to_html_str( '\nBinary file\n' ) + safe_str = to_safe_str( '\nBinary file\n' ) else: - to_html = '' + safe_str = '' for i, line in enumerate( open( file_path ) ): - to_html = '%s%s' % ( to_html, to_html_str( line ) ) - if len( to_html ) > MAX_CONTENT_SIZE: + safe_str = '%s%s' % ( safe_str, to_safe_str( line ) ) + if len( safe_str ) > MAX_CONTENT_SIZE: large_str = '\nFile contents truncated because file size is larger than maximum viewing size of %s\n' % util.nice_size( MAX_CONTENT_SIZE ) - to_html = '%s%s' % ( to_html, to_html_str( large_str ) ) + safe_str = '%s%s' % ( safe_str, to_safe_str( large_str ) ) break - return to_html + return safe_str def get_repository_files( trans, folder_path ): contents = [] for item in os.listdir( folder_path ): @@ -1631,7 +1631,7 @@ except: file_name = fpath return file_name -def to_html_str( text ): +def to_safe_str( text, to_html=True ): """Translates the characters in text to an html string""" translated = [] for c in text: @@ -1639,17 +1639,28 @@ translated.append( c ) elif c in MAPPED_CHARS: translated.append( MAPPED_CHARS[ c ] ) - elif c == ' ': - translated.append( ' ' ) - elif c == '\t': - translated.append( ' ' ) - elif c == '\n': - translated.append( '<br/>' ) - elif c not in [ '\r' ]: + elif c in [ '\n', '\r' ]: + if to_html: + translated.append( '<br/>' ) + else: + translated.append( c ) + elif c in [ ' ', ' ' ]: + translated.append( c ) + else: translated.append( '' ) return ''.join( translated ) def tool_shed_is_this_tool_shed( toolshed_base_url ): return toolshed_base_url.rstrip( '/' ) == str( url_for( '/', qualified=True ) ).rstrip( '/' ) +def translate_string( raw_text, to_html=True ): + if raw_text: + if len( raw_text ) <= MAX_CONTENT_SIZE: + translated_string = to_safe_str( raw_text, to_html=to_html ) + else: + large_str = '\nFile contents truncated because file size is larger than maximum viewing size of %s\n' % util.nice_size( MAX_CONTENT_SIZE ) + translated_string = to_safe_str( '%s%s' % ( raw_text[ 0:MAX_CONTENT_SIZE ], large_str ), to_html=to_html ) + else: + translated_string = '' + return translated_string def update_existing_tool_dependency( app, repository, original_dependency_dict, new_dependencies_dict ): """ Update an exsiting tool dependency whose definition was updated in a change set pulled by a Galaxy administrator when getting updates Repository URL:
https://bitbucket.org/galaxy/galaxy-central/
-- This is a commit notification from
bitbucket.org
. You are receiving this because you have the service enabled, addressing the recipient of this email.
1
0
0
0
← Newer
1
...
12
13
14
15
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Results per page:
10
25
50
100
200