commit/galaxy-central: kanwei: Upgrade to Mako 0.4.1 and fix failing tests due to entity escaping. Improve error message for checking strings in history.
1 new changeset in galaxy-central: http://bitbucket.org/galaxy/galaxy-central/changeset/5b9fe1d9b4fa/ changeset: 5b9fe1d9b4fa user: kanwei date: 2011-06-17 21:23:28 summary: Upgrade to Mako 0.4.1 and fix failing tests due to entity escaping. Improve error message for checking strings in history. affected #: 4 files (501 bytes) --- a/eggs.ini Fri Jun 17 15:00:22 2011 -0400 +++ b/eggs.ini Fri Jun 17 15:23:28 2011 -0400 @@ -38,7 +38,7 @@ elementtree = 1.2.6_20050316 GeneTrack = 2.0.0_beta_1 lrucache = 0.2 -Mako = 0.2.5 +Mako = 0.4.1 nose = 0.11.1 NoseHTML = 0.4.1 NoseTestDiff = 0.1 --- a/templates/sharing_base.mako Fri Jun 17 15:00:22 2011 -0400 +++ b/templates/sharing_base.mako Fri Jun 17 15:23:28 2011 -0400 @@ -41,13 +41,11 @@ <%def name="javascripts()"> ${parent.javascripts()} <script type="text/javascript"> - $(document).ready( function() - { + $(document).ready( function() { // // Set up slug-editing functionality. // - var on_start = function( text_elt ) - { + var on_start = function( text_elt ) { // Replace URL with URL text. $('#item-url').hide(); $('#item-url-text').show(); @@ -58,8 +56,7 @@ }); }; - var on_finish = function( text_elt ) - { + var on_finish = function( text_elt ) { // Replace URL text with URL. $('#item-url-text').hide(); $('#item-url').show(); @@ -81,20 +78,17 @@ ${parent.stylesheets()} <style> ## Put some whitespace before each section header. - h3 - { + h3 { margin-top: 2em; } - input.action-button - { + input.action-button { margin-left: 0; } ## If page is displayed in panels, pad from edges for readability. %if context.get('use_panels'): - div#center - { - padding: 10px; - } + div#center { + padding: 10px; + } %endif </style></%def> @@ -131,8 +125,8 @@ ## Require that user have a public username before sharing or publishing an item. %if trans.get_user().username is None or trans.get_user().username is "": - To make a ${item_class_name_lc} accessible via link or publish it, you must create a public username: - <p> + <p>To make a ${item_class_name_lc} accessible via link or publish it, you must create a public username:</p> + <form action="${h.url_for( action='set_public_username', id=trans.security.encode_id( item.id ) )}" method="POST"><div class="form-row"> @@ -181,38 +175,36 @@ <p>You can: <div> - <form action="${h.url_for( action='sharing', id=trans.security.encode_id( item.id ) )}" - method="POST"> - %if not item.published: - ## Item is importable but not published. User can disable importable or publish. - <input class="action-button" type="submit" name="disable_link_access" value="Disable Access to ${item_class_name} Link"> - <div class="toolParamHelp">Disables ${item_class_name_lc}'s link so that it is not accessible.</div> - <br> - <input class="action-button" type="submit" name="publish" value="Publish ${item_class_name}" method="POST"> - <div class="toolParamHelp">Publishes the ${item_class_name_lc} to Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section, where it is publicly listed and searchable.</div> + <form action="${h.url_for( action='sharing', id=trans.security.encode_id( item.id ) )}" method="POST"> + %if not item.published: + ## Item is importable but not published. User can disable importable or publish. + <input class="action-button" type="submit" name="disable_link_access" value="Disable Access to ${item_class_name} Link"> + <div class="toolParamHelp">Disables ${item_class_name_lc}'s link so that it is not accessible.</div> + <br /> + <input class="action-button" type="submit" name="publish" value="Publish ${item_class_name}" method="POST"> + <div class="toolParamHelp">Publishes the ${item_class_name_lc} to Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section, where it is publicly listed and searchable.</div> - <br> - %else: ## item.published == True - ## Item is importable and published. User can unpublish or disable import and unpublish. - <input class="action-button" type="submit" name="unpublish" value="Unpublish ${item_class_name}"> - <div class="toolParamHelp">Removes this ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div> - <br> - <input class="action-button" type="submit" name="disable_link_access_and_unpublish" value="Disable Access to ${item_class_name} via Link and Unpublish"> - <div class="toolParamHelp">Disables this ${item_class_name_lc}'s link so that it is not accessible and removes ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target='_top'>Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div> - %endif - + <br /> + %else: ## item.published == True + ## Item is importable and published. User can unpublish or disable import and unpublish. + <input class="action-button" type="submit" name="unpublish" value="Unpublish ${item_class_name}"> + <div class="toolParamHelp">Removes this ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target="_top">Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div> + <br /> + <input class="action-button" type="submit" name="disable_link_access_and_unpublish" value="Disable Access to ${item_class_name} via Link and Unpublish"> + <div class="toolParamHelp">Disables this ${item_class_name_lc}'s link so that it is not accessible and removes ${item_class_name_lc} from Galaxy's <a href='${h.url_for( action='list_published' )}' target='_top'>Published ${item_class_plural_name}</a> section so that it is not publicly listed or searchable.</div> + %endif </form></div> %else: - This ${item_class_name_lc} is currently restricted so that only you and the users listed below can access it. You can: - <p> + <p>This ${item_class_name_lc} is currently restricted so that only you and the users listed below can access it. You can:</p> + <form action="${h.url_for( action='sharing', id=trans.security.encode_id(item.id) )}" method="POST"><input class="action-button" type="submit" name="make_accessible_via_link" value="Make ${item_class_name} Accessible via Link"><div class="toolParamHelp">Generates a web link that you can share with other people so that they can view and import the ${item_class_name_lc}.</div> - <br> + <br /><input class="action-button" type="submit" name="make_accessible_and_publish" value="Make ${item_class_name} Accessible and Publish" method="POST"><div class="toolParamHelp">Makes the ${item_class_name_lc} accessible via link (see above) and publishes the ${item_class_name_lc} to Galaxy's <a href='${h.url_for( action='list_published' )}' target='_top'>Published ${item_class_plural_name}</a> section, where it is publicly listed and searchable.</div></form> @@ -266,13 +258,13 @@ href="${h.url_for( action='share', id=trans.security.encode_id(item.id), use_panels=use_panels )}"><span>Share with a user</span></a> - <br> + <br /> %endif </div></div> %endif - <p><br><br> + <br /><br /><a href="${h.url_for( action="list" )}">Back to ${item_class_plural_name} List</a></%def> \ No newline at end of file --- a/test/base/twilltestcase.py Fri Jun 17 15:00:22 2011 -0400 +++ b/test/base/twilltestcase.py Fri Jun 17 15:23:28 2011 -0400 @@ -8,6 +8,8 @@ import twill.commands as tc from twill.other_packages._mechanize_dist import ClientForm pkg_resources.require( "elementtree" ) +pkg_resources.require( "MarkupSafe" ) +from markupsafe import escape from elementtree import ElementTree from galaxy.web import security from galaxy.web.framework.helpers import iff @@ -239,7 +241,12 @@ else: self.visit_page( "history" ) for subpatt in patt.split(): - tc.find(subpatt) + try: + tc.find( escape(subpatt) ) + except: + fname = self.write_temp_file( tc.browser.get_html() ) + errmsg = "no match to '%s'\npage content written to '%s'" % ( escape(subpatt), fname ) + raise AssertionError( errmsg ) self.home() def clear_history( self ): """Empties a history of all datasets""" @@ -611,13 +618,10 @@ return hids def makeTfname(self, fname=None): - """ - safe temp name - preserve the file extension for tools that interpret it - """ + """safe temp name - preserve the file extension for tools that interpret it""" suffix = os.path.split(fname)[-1] # ignore full path - fd,temp_prefix = tempfile.mkstemp(prefix='tmp',suffix=suffix) - return temp_prefix - + fd,temp_prefix = tempfile.mkstemp(prefix='tmp',suffix=suffix) + return temp_prefix def verify_dataset_correctness( self, filename, hid=None, wait=True, maxseconds=120, attributes=None ): """Verifies that the attributes and contents of a history item meet expectations""" @@ -673,12 +677,12 @@ self.files_re_match( local_name, temp_name, attributes=attributes ) elif compare == 're_match_multiline': self.files_re_match_multiline( local_name, temp_name, attributes=attributes ) - elif compare == 'sim_size': - delta = attributes.get('delta','100') - s1 = len(data) - s2 = os.path.getsize(local_name) - if abs(s1-s2) > int(delta): - raise Exception, 'Files %s=%db but %s=%db - compare (delta=%s) failed' % (temp_name,s1,local_name,s2,delta) + elif compare == 'sim_size': + delta = attributes.get('delta','100') + s1 = len(data) + s2 = os.path.getsize(local_name) + if abs(s1-s2) > int(delta): + raise Exception, 'Files %s=%db but %s=%db - compare (delta=%s) failed' % (temp_name,s1,local_name,s2,delta) elif compare == "contains": self.files_contains( local_name, temp_name, attributes=attributes ) else: @@ -749,7 +753,7 @@ errmsg += str( err ) raise AssertionError( errmsg ) finally: - os.remove( temp_name ) + os.remove( temp_name ) def is_zipped( self, filename ): if not zipfile.is_zipfile( filename ): --- a/test/functional/test_history_functions.py Fri Jun 17 15:00:22 2011 -0400 +++ b/test/functional/test_history_functions.py Fri Jun 17 15:23:28 2011 -0400 @@ -282,9 +282,9 @@ .first() assert hda_3_bed is not None, "Problem retrieving hda_3_bed from database" # Make sure the deleted datasets are included in the cloned history - check_str = 'This dataset has been deleted. Click undelete id=%d"' % hda_2_bed.id + check_str = 'This dataset has been deleted. Click undelete id=%d' % hda_2_bed.id self.check_history_for_string( check_str, show_deleted=True ) - check_str = 'This dataset has been deleted. Click undelete id=%d"' % hda_3_bed.id + check_str = 'This dataset has been deleted. Click undelete id=%d' % hda_3_bed.id self.check_history_for_string( check_str, show_deleted=True ) # Test cloning only active datasets self.clone_history( self.security.encode_id( history3.id ), @@ -353,7 +353,7 @@ .first() assert history5 is not None, "Problem retrieving history5 from database" self.rename_history( self.security.encode_id( history5.id ), history5.name, new_name=urllib.quote( 'history 5' ) ) - # Current history is hostory5 + # Current history is history5 sa_session.refresh( history5 ) # Due to the limitations of twill ( not functional with the permissions forms ), we're forced # to do this manually. At this point, we just want to restrict the access permission on history5 @@ -514,7 +514,7 @@ self.visit_page( "root/history_options" ) try: self.check_page_for_string( 'List</a> histories shared with you by others' ) - raise AssertionError, "history5 still shared with regular_user2 after unshaing it with that user." + raise AssertionError, "history5 still shared with regular_user2 after unsharing it with that user." except: pass self.logout() 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.
participants (1)
-
Bitbucket