1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/d60deede2b6a/ changeset: d60deede2b6a user: greg date: 2012-11-12 21:55:24 summary: Make the directory containing the tool shed's hgweb.config file a setting in the tool shed config. affected #: 31 files diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b community_wsgi.ini.sample --- a/community_wsgi.ini.sample +++ b/community_wsgi.ini.sample @@ -26,6 +26,9 @@ # You may use a SQLAlchemy connection string to specify an external database instead #database_connection = postgres:///community_test?host=/var/run/postgresql +# Where the hgweb.config file is stored. The default is the Galaxy installation directory. +#hgweb_config_dir = None + # Where dataset files are saved file_path = database/community_files # Temporary storage for additional datasets, this should be shared through the cluster diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -42,10 +42,11 @@ class ShedCounter( object ): def __init__( self, model ): + # TODO: Enhance the ShedCounter to retrieve information from the db instead of displaying what's currently in memory. self.model = model self.generation_time = strftime( "%b %d, %Y", gmtime() ) self.repositories = 0 - self.new_repositories = 0 + #self.new_repositories = 0 self.deleted_repositories = 0 self.invalid_tools = 0 self.valid_tools = 0 @@ -59,7 +60,7 @@ return self.model.context def generate_statistics( self ): self.repositories = 0 - self.new_repositories = 0 + #self.new_repositories = 0 self.deleted_repositories = 0 self.invalid_tools = 0 self.valid_tools = 0 @@ -70,14 +71,15 @@ self.repositories += 1 self.total_clones += repository.times_downloaded is_deleted = repository.deleted - is_new = repository.is_new - if is_deleted and is_new: + #is_new = repository.is_new + #if is_deleted and is_new: + if is_deleted: self.deleted_repositories += 1 - self.new_repositories += 1 - elif is_deleted: - self.deleted_repositories += 1 - elif is_new: - self.new_repositories += 1 + # self.new_repositories += 1 + #elif is_deleted: + # self.deleted_repositories += 1 + #elif is_new: + # self.new_repositories += 1 else: processed_guids = [] processed_invalid_tool_configs = [] @@ -763,8 +765,8 @@ """ Generate metadata for a repository using it's files on disk. To generate metadata for changeset revisions older than the repository tip, the repository will have been cloned to a temporary location and updated to a specified changeset revision to access that changeset revision's - disk files, so the value of repository_files_dir will not always be repository.repo_path (it could be an absolute path to a temporary directory - containing a clone). If it is an absolute path, the value of relative_install_dir must contain repository.repo_path. + disk files, so the value of repository_files_dir will not always be repository.repo_path( app ) (it could be an absolute path to a temporary + directory containing a clone). If it is an absolute path, the value of relative_install_dir must contain repository.repo_path( app ). The value of persist will be True when the installed repository contains a valid tool_data_table_conf.xml.sample file, in which case the entries should ultimately be persisted to the file referred to by app.config.shed_tool_data_table_config. @@ -784,7 +786,7 @@ original_tool_data_table_config_path = app.config.tool_data_table_config_path if resetting_all_metadata_on_repository: if not relative_install_dir: - raise Exception( "The value of repository.repo_path must be sent when resetting all metadata on a repository." ) + raise Exception( "The value of repository.repo_path( app ) must be sent when resetting all metadata on a repository." ) # Keep track of the location where the repository is temporarily cloned so that we can strip the path when setting metadata. The value of # repository_files_dir is the full path to the temporary directory to which the repository was cloned. work_dir = repository_files_dir @@ -907,7 +909,7 @@ app.config.tool_data_path = original_tool_data_path app.config.tool_data_table_config_path = original_tool_data_table_config_path return metadata_dict, invalid_file_tups -def generate_message_for_invalid_tools( invalid_file_tups, repository, metadata_dict, as_html=True, displaying_invalid_tool=False ): +def generate_message_for_invalid_tools( trans, invalid_file_tups, repository, metadata_dict, as_html=True, displaying_invalid_tool=False ): if as_html: new_line = '<br/>' bold_start = '<b>' @@ -919,10 +921,10 @@ message = '' if not displaying_invalid_tool: if metadata_dict: - message += "Metadata was defined for some items in revision '%s'. " % str( repository.tip ) + message += "Metadata was defined for some items in revision '%s'. " % str( repository.tip( trans.app ) ) message += "Correct the following problems if necessary and reset metadata.%s" % new_line else: - message += "Metadata cannot be defined for revision '%s' so this revision cannot be automatically " % str( repository.tip ) + message += "Metadata cannot be defined for revision '%s' so this revision cannot be automatically " % str( repository.tip( trans.app ) ) message += "installed into a local Galaxy instance. Correct the following problems and reset metadata.%s" % new_line for itc_tup in invalid_file_tups: tool_file, exception_msg = itc_tup @@ -1351,6 +1353,11 @@ ctx = get_changectx_for_changeset( repo, changeset_revision ) named_tmp_file = get_named_tmpfile_from_ctx( ctx, file_name, dir ) return named_tmp_file +def get_hgweb_config( app ): + hgweb_config = os.path.join( app.config.hgweb_config_dir, 'hgweb.config' ) + if not os.path.exists( hgweb_config ): + raise Exception( "Required file %s does not exist - check config setting for hgweb_config_dir." % hgweb_config ) + return hgweb_config def get_installed_tool_shed_repository( trans, id ): """Get a repository on the Galaxy side from the database via id""" return trans.sa_session.query( trans.model.ToolShedRepository ).get( trans.security.decode_id( id ) ) @@ -2229,7 +2236,7 @@ trans.sa_session.flush() repository = get_repository_in_tool_shed( trans, id ) log.debug( "Resetting all metadata on repository: %s" % repository.name ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) repository_clone_url = generate_clone_url_for_repository_in_tool_shed( trans, repository ) # The list of changeset_revisions refers to repository_metadata records that have been created or updated. When the following loop @@ -2329,7 +2336,7 @@ repository = get_installed_tool_shed_repository( trans, repository_id ) invalid_file_tups, metadata_dict = reset_all_metadata_on_installed_repository( trans, repository_id ) if invalid_file_tups: - message = generate_message_for_invalid_tools( invalid_file_tups, repository, None, as_html=False ) + message = generate_message_for_invalid_tools( trans, invalid_file_tups, repository, None, as_html=False ) log.debug( message ) unsuccessful_count += 1 else: diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/config.py --- a/lib/galaxy/webapps/community/config.py +++ b/lib/galaxy/webapps/community/config.py @@ -92,6 +92,8 @@ self.job_handlers = [] self.tool_handlers = [] self.tool_runners = [] + # Where the tool shed hgweb.config file is stored - the default is the Galaxy installation directory. + self.hgweb_config_dir = resolve_path( kwargs.get( 'hgweb_config_dir', '' ), self.root ) # Proxy features self.apache_xsendfile = kwargs.get( 'apache_xsendfile', False ) self.nginx_x_accel_redirect_base = kwargs.get( 'nginx_x_accel_redirect_base', False ) @@ -112,7 +114,7 @@ return default def check( self ): # Check that required directories exist. - paths_to_check = [ self.root, self.file_path, self.tool_data_path, self.template_path ] + paths_to_check = [ self.root, self.file_path, self.hgweb_config_dir, self.tool_data_path, self.template_path ] for path in paths_to_check: if path not in [ None, False ] and not os.path.isdir( path ): try: diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/controllers/admin.py --- a/lib/galaxy/webapps/community/controllers/admin.py +++ b/lib/galaxy/webapps/community/controllers/admin.py @@ -344,7 +344,7 @@ class RevisionColumn( grids.TextColumn ): def get_value( self, trans, grid, repository_metadata ): repository = repository_metadata.repository - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) ctx = get_changectx_for_changeset( repo, repository_metadata.changeset_revision ) return "%s:%s" % ( str( ctx.rev() ), repository_metadata.changeset_revision ) class ToolsColumn( grids.TextColumn ): @@ -516,7 +516,7 @@ if k.startswith( changset_revision_str ): repository_id = trans.security.encode_id( int( k.lstrip( changset_revision_str ) ) ) repository = get_repository_in_tool_shed( trans, repository_id ) - if repository.tip != v: + if repository.tip( trans.app ) != v: return trans.response.send_redirect( web.url_for( controller='repository', action='browse_repositories', operation='view_or_manage_repository', diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/controllers/common.py --- a/lib/galaxy/webapps/community/controllers/common.py +++ b/lib/galaxy/webapps/community/controllers/common.py @@ -139,7 +139,7 @@ if not file_path or not os.path.exists( file_path ): # The file no longer exists on disk, so it must have been deleted at some previous point in the change log. return False - if changeset_revision == repository.tip: + if changeset_revision == repository.tip( trans.app ): return True file_name = strip_path( file_path ) latest_version_of_file = get_latest_tool_config_revision_from_repository_manifest( repo, file_name, changeset_revision ) @@ -327,7 +327,7 @@ previous_changeset_revision = current_changeset_revision def get_previous_repository_reviews( trans, repository, changeset_revision ): """Return an ordered dictionary of repository reviews up to and including the received changeset revision.""" - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) reviewed_revision_hashes = [ review.changeset_revision for review in repository.reviews ] previous_reviews_dict = odict() for changeset in reversed_upper_bounded_changelog( repo, changeset_revision ): @@ -340,10 +340,10 @@ previous_reviews_dict[ previous_changeset_revision ] = dict( changeset_revision_label=previous_changeset_revision_label, reviews=revision_reviews ) return previous_reviews_dict -def get_rev_label_changeset_revision_from_repository_metadata( repository_metadata, repository=None ): +def get_rev_label_changeset_revision_from_repository_metadata( trans, repository_metadata, repository=None ): if repository is None: repository = repository_metadata.repository - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) changeset_revision = repository_metadata.changeset_revision ctx = get_changectx_for_changeset( repo, changeset_revision ) if ctx: @@ -424,7 +424,7 @@ Return a string consisting of the human read-able changeset rev and the changeset revision string. """ - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) ctx = get_changectx_for_changeset( repo, changeset_revision ) if ctx: return "%s:%s" % ( str( ctx.rev() ), changeset_revision ) @@ -454,7 +454,7 @@ # 4. A regular user checks the "Receive email alerts" check box on the manage repository page. Since the # user is not an admin user, the email will not include any information about both HTML and image content # that was included in the change set. - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) smtp_server = trans.app.config.smtp_server if smtp_server and ( new_repo_alert or repository.email_alerts ): @@ -522,7 +522,7 @@ log.exception( "An error occurred sending a tool shed repository update alert by email." ) def has_previous_repository_reviews( trans, repository, changeset_revision ): """Determine if a repository has a changeset revision review prior to the received changeset revision.""" - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) reviewed_revision_hashes = [ review.changeset_revision for review in repository.reviews ] for changeset in reversed_upper_bounded_changelog( repo, changeset_revision ): previous_changeset_revision = str( repo.changectx( changeset ) ) @@ -537,7 +537,7 @@ """ original_tool_data_path = trans.app.config.tool_data_path repository = get_repository_in_tool_shed( trans, repository_id ) - repo_files_dir = repository.repo_path + repo_files_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_files_dir ) message = '' tool = None @@ -555,7 +555,8 @@ tool, sample_files ) if invalid_files_and_errors_tups: - message2 = generate_message_for_invalid_tools( invalid_files_and_errors_tups, + message2 = generate_message_for_invalid_tools( trans, + invalid_files_and_errors_tups, repository, metadata_dict=None, as_html=True, @@ -631,7 +632,7 @@ status = 'done' encoded_id = trans.security.encode_id( repository.id ) repository_clone_url = generate_clone_url_for_repository_in_tool_shed( trans, repository ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) metadata_dict, invalid_file_tups = generate_metadata_for_changeset_revision( app=trans.app, repository=repository, @@ -649,7 +650,7 @@ repository_metadata = create_or_update_repository_metadata( trans, encoded_id, repository, - repository.tip, + repository.tip( trans.app ), metadata_dict ) # If this is the first record stored for this repository, see if we need to send any email alerts. if len( repository.downloadable_revisions ) == 1: @@ -659,7 +660,7 @@ if repository_metadata: downloadable = is_downloadable( metadata_dict ) # Update the last saved repository_metadata table row. - repository_metadata.changeset_revision = repository.tip + repository_metadata.changeset_revision = repository.tip( trans.app ) repository_metadata.metadata = metadata_dict repository_metadata.downloadable = downloadable trans.sa_session.add( repository_metadata ) @@ -669,7 +670,7 @@ repository_metadata = create_or_update_repository_metadata( trans, encoded_id, repository, - repository.tip, + repository.tip( trans.app ), metadata_dict ) if 'tools' in metadata_dict and repository_metadata and status != 'error': # Set tool versions on the new downloadable change set. The order of the list of changesets is critical, so we use the repo's changelog. @@ -680,11 +681,11 @@ changeset_revisions.append( changeset_revision ) add_tool_versions( trans, encoded_id, repository_metadata, changeset_revisions ) elif len( repo ) == 1 and not invalid_file_tups: - message = "Revision '%s' includes no tools, datatypes or exported workflows for which metadata can " % str( repository.tip ) + message = "Revision '%s' includes no tools, datatypes or exported workflows for which metadata can " % str( repository.tip( trans.app ) ) message += "be defined so this revision cannot be automatically installed into a local Galaxy instance." status = "error" if invalid_file_tups: - message = generate_message_for_invalid_tools( invalid_file_tups, repository, metadata_dict ) + message = generate_message_for_invalid_tools( trans, invalid_file_tups, repository, metadata_dict ) status = 'error' # Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file. reset_tool_data_tables( trans.app ) @@ -704,7 +705,7 @@ # is not supported by the mercurial API. # Make a copy of a repository's files for browsing, remove from disk all files that are not tracked, and commit all # added, modified or removed files that have not yet been committed. - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) # The following will delete the disk copy of only the files in the repository. #os.system( 'hg update -r null > /dev/null 2>&1' ) diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/controllers/hg.py --- a/lib/galaxy/webapps/community/controllers/hg.py +++ b/lib/galaxy/webapps/community/controllers/hg.py @@ -1,7 +1,7 @@ import os, logging from galaxy.web.base.controller import * from galaxy.webapps.community.controllers.common import * -from galaxy.util.shed_util import update_repository +from galaxy.util.shed_util import get_hgweb_config from galaxy import eggs eggs.require('mercurial') @@ -14,10 +14,16 @@ class HgController( BaseUIController ): @web.expose def handle_request( self, trans, **kwd ): - # The os command that results in this method being called will look something like + # The os command that results in this method being called will look something like: # hg clone http://test@127.0.0.1:9009/repos/test/convert_characters1 hg_version = mercurial.__version__.version cmd = kwd.get( 'cmd', None ) + hgweb_config = get_hgweb_config( trans.app ) + if not os.path.exists( hgweb_config ): + raise Exception( "Required file %s does not exist." % str( hgweb_config ) ) + def make_web_app(): + hgwebapp = hgwebdir( hgweb_config ) + return hgwebapp wsgi_app = wsgiapplication( make_web_app ) if hg_version >= '2.2.3' and cmd == 'pushkey': # When doing an "hg push" from the command line, the following commands, in order, will be retrieved from environ, depending @@ -33,15 +39,8 @@ if hg_version >= '2.2.3': # Set metadata using the repository files on disk. error_message, status = set_repository_metadata( trans, repository ) - if status not in [ 'ok' ] and error_message: - log.debug( "Error resetting metadata on repository '%s': %s" % ( str( repository.name ), str( error_message ) ) ) - elif status in [ 'ok' ] and error_message: - log.debug( "Successfully reset metadata on repository %s, but encountered problem: %s" % ( str( repository.name ), str( error_message ) ) ) + if status == 'ok' and error_message: + log.debug( "Successfully reset metadata on repository %s, but encountered problem: %s" % ( repository.name, error_message ) ) + elif status != 'ok' and error_message: + log.debug( "Error resetting metadata on repository %s: %s" % ( repository.name, error_message ) ) return wsgi_app - -def make_web_app(): - hgweb_config = "%s/hgweb.config" % os.getcwd() - if not os.path.exists( hgweb_config ): - raise Exception( "Required file hgweb.config does not exist in directory %s" % os.getcwd() ) - hgwebapp = hgwebdir( hgweb_config ) - return hgwebapp diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -11,12 +11,12 @@ from galaxy.model.orm import * # TODO: re-factor shed_util to eliminate the following restricted imports from galaxy.util.shed_util import create_repo_info_dict, generate_clone_url_for_repository_in_tool_shed, generate_message_for_invalid_tools -from galaxy.util.shed_util import get_changectx_for_changeset, get_configured_ui, get_file_from_changeset_revision, get_repository_file_contents -from galaxy.util.shed_util import get_repository_in_tool_shed, get_repository_metadata_by_changeset_revision, handle_sample_files_and_load_tool_from_disk -from galaxy.util.shed_util import handle_sample_files_and_load_tool_from_tmp_config, INITIAL_CHANGELOG_HASH, load_tool_from_config, NOT_TOOL_CONFIGS -from galaxy.util.shed_util import open_repository_files_folder, remove_dir, reset_all_metadata_on_repository_in_tool_shed -from galaxy.util.shed_util import reversed_lower_upper_bounded_changelog, reversed_upper_bounded_changelog, strip_path, to_html_escaped -from galaxy.util.shed_util import update_repository, url_join +from galaxy.util.shed_util import get_changectx_for_changeset, get_configured_ui, get_file_from_changeset_revision, get_hgweb_config +from galaxy.util.shed_util import get_repository_file_contents, get_repository_in_tool_shed, get_repository_metadata_by_changeset_revision +from galaxy.util.shed_util import handle_sample_files_and_load_tool_from_disk, handle_sample_files_and_load_tool_from_tmp_config +from galaxy.util.shed_util import INITIAL_CHANGELOG_HASH, load_tool_from_config, NOT_TOOL_CONFIGS, open_repository_files_folder, remove_dir +from galaxy.util.shed_util import reset_all_metadata_on_repository_in_tool_shed, reversed_lower_upper_bounded_changelog +from galaxy.util.shed_util import reversed_upper_bounded_changelog, strip_path, to_html_escaped, update_repository, url_join from galaxy.tool_shed.encoding_util import * from common import * @@ -129,7 +129,7 @@ grids.GridColumn.__init__( self, col_name ) def get_value( self, trans, grid, repository ): """Display the repository tip revision label.""" - return escape_html( repository.revision ) + return escape_html( repository.revision( trans.app ) ) class DescriptionColumn( grids.TextColumn ): def get_value( self, trans, grid, repository ): return escape_html( repository.description ) @@ -361,7 +361,7 @@ for repository in trans.sa_session.query( model.Repository ) \ .filter( and_( model.Repository.table.c.deprecated == False, model.Repository.table.c.deleted == False ) ): - allow_push = repository.allow_push + allow_push = repository.allow_push( trans.app ) if allow_push: allow_push_usernames = allow_push.split( ',' ) if username in allow_push_usernames: @@ -533,7 +533,7 @@ def __add_hgweb_config_entry( self, trans, repository, repository_path ): # Add an entry in the hgweb.config file for a new repository. An entry looks something like: # repos/test/mira_assembler = database/community_files/000/repo_123. - hgweb_config = "%s/hgweb.config" % trans.app.config.root + hgweb_config = get_hgweb_config( trans.app ) if repository_path.startswith( './' ): repository_path = repository_path.replace( './', '', 1 ) entry = "repos/%s/%s = %s" % ( repository.user.username, repository.name, repository_path ) @@ -700,7 +700,7 @@ if k.startswith( changset_revision_str ): repository_id = trans.security.encode_id( int( k.lstrip( changset_revision_str ) ) ) repository = get_repository_in_tool_shed( trans, repository_id ) - if repository.tip != v: + if repository.tip( trans.app ) != v: return trans.response.send_redirect( web.url_for( controller='repository', action='browse_repositories', operation='view_or_manage_repository', @@ -714,11 +714,11 @@ status = params.get( 'status', 'done' ) commit_message = util.restore_text( params.get( 'commit_message', 'Deleted selected files' ) ) repository = get_repository_in_tool_shed( trans, id ) - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) # Update repository files for browsing. update_repository( repo ) - is_malicious = changeset_is_malicious( trans, id, repository.tip ) - metadata = self.get_metadata( trans, id, repository.tip ) + is_malicious = changeset_is_malicious( trans, id, repository.tip( trans.app ) ) + metadata = self.get_metadata( trans, id, repository.tip( trans.app ) ) return trans.fill_template( '/webapps/community/repository/browse_repository.mako', repository=repository, metadata=metadata, @@ -799,7 +799,7 @@ if k.startswith( changset_revision_str ): repository_id = trans.security.encode_id( int( k.lstrip( changset_revision_str ) ) ) repository = get_repository_in_tool_shed( trans, repository_id ) - if repository.tip != v: + if repository.tip( trans.app ) != v: return trans.response.send_redirect( web.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=trans.security.encode_id( repository.id ), @@ -828,10 +828,10 @@ # Change an entry in the hgweb.config file for a repository. This only happens when # the owner changes the name of the repository. An entry looks something like: # repos/test/mira_assembler = database/community_files/000/repo_123. - hgweb_config = "%s/hgweb.config" % trans.app.config.root + hgweb_config = get_hgweb_config( trans.app ) # Make a backup of the hgweb.config file since we're going to be changing it. self.__make_hgweb_config_copy( trans, hgweb_config ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) old_lhs = "repos/%s/%s" % ( repository.user.username, old_repository_name ) new_entry = "repos/%s/%s = %s\n" % ( repository.user.username, new_repository_name, repo_dir ) tmp_fd, tmp_fname = tempfile.mkstemp() @@ -855,7 +855,7 @@ owner = params.get( 'owner', None ) changeset_revision = params.get( 'changeset_revision', None ) repository = get_repository_by_name_and_owner( trans, name, owner ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) # Default to the current changeset revision. update_to_ctx = get_changectx_for_changeset( repo, changeset_revision ) @@ -869,7 +869,7 @@ url = url_join( galaxy_url, 'admin_toolshed/update_to_changeset_revision?tool_shed_url=%s&name=%s&owner=%s&changeset_revision=%s&latest_changeset_revision=' % \ ( url_for( '/', qualified=True ), repository.name, repository.user.username, changeset_revision ) ) - if changeset_revision == repository.tip: + if changeset_revision == repository.tip( trans.app ): # If changeset_revision is the repository tip, there are no additional updates. if from_update_manager: return no_update @@ -894,7 +894,7 @@ changeset_hash = str( repo.changectx( changeset ) ) ctx = get_changectx_for_changeset( repo, changeset_hash ) if update_to_changeset_hash: - if changeset_hash == repository.tip: + if changeset_hash == repository.tip( trans.app ): update_to_ctx = get_changectx_for_changeset( repo, changeset_hash ) latest_changeset_revision = changeset_hash break @@ -926,7 +926,7 @@ message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) repository = get_repository_in_tool_shed( trans, id ) - metadata = self.get_metadata( trans, id, repository.tip ) + metadata = self.get_metadata( trans, id, repository.tip( trans.app ) ) if trans.user and trans.user.email: return trans.fill_template( "/webapps/community/repository/contact_owner.mako", repository=repository, @@ -936,12 +936,12 @@ else: # Do all we can to eliminate spam. return trans.show_error_message( "You must be logged in to contact the owner of a repository." ) - def __create_hgrc_file( self, repository ): - # At this point, an entry for the repository is required to be in the hgweb.config file so we can call repository.repo_path. - # Since we support both http and https, we set push_ssl to False to override the default (which is True) in the mercurial api. - # The hg purge extension purges all files and directories not being tracked by mercurial in the current repository. It'll - # remove unknown files and empty directories. This is not currently used because it is not supported in the mercurial API. - repo = hg.repository( get_configured_ui(), path=repository.repo_path ) + def __create_hgrc_file( self, trans, repository ): + # At this point, an entry for the repository is required to be in the hgweb.config file so we can call repository.repo_path( trans.app ). + # Since we support both http and https, we set push_ssl to False to override the default (which is True) in the mercurial api. The hg + # purge extension purges all files and directories not being tracked by mercurial in the current repository. It'll remove unknown files + # and empty directories. This is not currently used because it is not supported in the mercurial API. + repo = hg.repository( get_configured_ui(), path=repository.repo_path( trans.app ) ) fp = repo.opener( 'hgrc', 'wb' ) fp.write( '[paths]\n' ) fp.write( 'default = .\n' ) @@ -1001,11 +1001,10 @@ os.makedirs( repository_path ) # Create the local repository repo = hg.repository( get_configured_ui(), repository_path, create=True ) - # Add an entry in the hgweb.config file for the local repository - # This enables calls to repository.repo_path + # Add an entry in the hgweb.config file for the local repository, enabling calls to repository.repo_path( trans.app ) self.__add_hgweb_config_entry( trans, repository, repository_path ) # Create a .hg/hgrc file for the local repository - self.__create_hgrc_file( repository ) + self.__create_hgrc_file( trans, repository ) flush_needed = False if category_ids: # Create category associations @@ -1057,7 +1056,7 @@ status = params.get( 'status', 'done' ) repository, tool, message = load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config ) tool_state = self.__new_state( trans ) - is_malicious = changeset_is_malicious( trans, repository_id, repository.tip ) + is_malicious = changeset_is_malicious( trans, repository_id, repository.tip( trans.app ) ) metadata = self.get_metadata( trans, repository_id, changeset_revision ) try: return trans.fill_template( "/webapps/community/repository/tool_form.mako", @@ -1284,7 +1283,7 @@ repository_owner = kwd[ 'owner' ] changeset_revision = kwd[ 'changeset_revision' ] repository = get_repository_by_name_and_owner( trans, repository_name, repository_owner ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) ctx = get_changectx_for_changeset( repo, changeset_revision ) if ctx: @@ -1320,7 +1319,7 @@ includes_tools = True if not includes_tool_dependencies and 'tool_dependencies' in metadata: includes_tool_dependencies = True - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) ctx = get_changectx_for_changeset( repo, changeset_revision ) repo_info_dict = create_repo_info_dict( repository, repository.user.username, repository_clone_url, changeset_revision, str( ctx.rev() ), metadata ) @@ -1378,7 +1377,7 @@ owner = kwd[ 'owner' ] changeset_revision = kwd[ 'changeset_revision' ] repository = get_repository_by_name_and_owner( trans, name, owner ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) tool_version_dicts = [] for changeset in repo.changelog: @@ -1402,14 +1401,14 @@ owner = params.get( 'owner', None ) changeset_revision = params.get( 'changeset_revision', None ) repository = get_repository_by_name_and_owner( trans, name, owner ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) # Default to the received changeset revision and ctx_rev. update_to_ctx = get_changectx_for_changeset( repo, changeset_revision ) ctx_rev = str( update_to_ctx.rev() ) latest_changeset_revision = changeset_revision update_dict = dict( changeset_revision=changeset_revision, ctx_rev=ctx_rev ) - if changeset_revision == repository.tip: + if changeset_revision == repository.tip( trans.app ): # If changeset_revision is the repository tip, there are no additional updates. return tool_shed_encode( update_dict ) else: @@ -1429,7 +1428,7 @@ if update_to_changeset_hash: if get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), changeset_hash ): # We found a RepositoryMetadata record. - if changeset_hash == repository.tip: + if changeset_hash == repository.tip( trans.app ): # The current ctx is the repository tip, so use it. update_to_ctx = get_changectx_for_changeset( repo, changeset_hash ) latest_changeset_revision = changeset_hash @@ -1446,7 +1445,7 @@ def get_versions_of_tool( self, trans, repository, repository_metadata, guid ): """Return the tool lineage in descendant order for the received guid contained in the received repsitory_metadata.tool_versions.""" encoded_id = trans.security.encode_id( repository.id ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) # Initialize the tool lineage tool_guid_lineage = [ guid ] @@ -1462,7 +1461,7 @@ current_child_guid = parent_guid # Get all descendant guids of the received guid. current_parent_guid = guid - for changeset in reversed_lower_upper_bounded_changelog( repo, repository_metadata.changeset_revision, repository.tip ): + for changeset in reversed_lower_upper_bounded_changelog( repo, repository_metadata.changeset_revision, repository.tip( trans.app ) ): ctx = repo.changectx( changeset ) rm = get_repository_metadata_by_changeset_revision( trans, encoded_id, str( ctx ) ) if rm: @@ -1581,16 +1580,16 @@ repository_clone_url = generate_clone_url( trans, repository_id ) repository, tool, error_message = load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config ) tool_state = self.__new_state( trans ) - is_malicious = changeset_is_malicious( trans, repository_id, repository.tip ) + is_malicious = changeset_is_malicious( trans, repository_id, repository.tip( trans.app ) ) invalid_file_tups = [] if tool: invalid_file_tups = check_tool_input_params( trans.app, - repository.repo_path, + repository.repo_path( trans.app ), tool_config, tool, [] ) if invalid_file_tups: - message = generate_message_for_invalid_tools( invalid_file_tups, repository, {}, as_html=True, displaying_invalid_tool=True ) + message = generate_message_for_invalid_tools( trans, invalid_file_tups, repository, {}, as_html=True, displaying_invalid_tool=True ) elif error_message: message = error_message try: @@ -1622,7 +1621,8 @@ # Make a backup of the hgweb.config file today = date.today() backup_date = today.strftime( "%Y_%m_%d" ) - hgweb_config_copy = '%s/hgweb.config_%s_backup' % ( trans.app.config.root, backup_date ) + hgweb_config_backup_filename = 'hgweb.config_%s_backup' % backup_date + hgweb_config_copy = os.path.join( trans.app.config.hgweb_config_dir, hgweb_config_backup_filename ) shutil.copy( os.path.abspath( hgweb_config ), os.path.abspath( hgweb_config_copy ) ) def __make_same_length( self, list1, list2 ): # If either list is 1 item, we'll append to it until its length is the same as the other. @@ -1672,10 +1672,10 @@ status = params.get( 'status', 'done' ) cntrller = params.get( 'cntrller', 'repository' ) repository = get_repository_in_tool_shed( trans, id ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) repo_name = util.restore_text( params.get( 'repo_name', repository.name ) ) - changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) ) + changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip( trans.app ) ) ) description = util.restore_text( params.get( 'description', repository.description ) ) long_description = util.restore_text( params.get( 'long_description', repository.long_description ) ) avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model ) @@ -1746,7 +1746,7 @@ user = trans.sa_session.query( trans.model.User ).get( trans.security.decode_id( user_id ) ) usernames.append( user.username ) usernames = ','.join( usernames ) - repository.set_allow_push( usernames, remove_auth=remove_auth ) + repository.set_allow_push( trans.app, usernames, remove_auth=remove_auth ) message = "The repository information has been updated." elif params.get( 'receive_email_alerts_button', False ): flush_needed = False @@ -1766,8 +1766,9 @@ message = "The repository information has been updated." if error: status = 'error' - if repository.allow_push: - current_allow_push_list = repository.allow_push.split( ',' ) + current_allow_push = repository.allow_push( trans.app ) + if current_allow_push: + current_allow_push_list = current_allow_push.split( ',' ) else: current_allow_push_list = [] allow_push_select_field = self.__build_allow_push_select_field( trans, current_allow_push_list ) @@ -1778,7 +1779,7 @@ selected_value=changeset_revision, add_id_to_name=False, downloadable=False ) - revision_label = get_revision_label( trans, repository, repository.tip ) + revision_label = get_revision_label( trans, repository, repository.tip( trans.app ) ) repository_metadata_id = None metadata = None is_malicious = False @@ -1800,7 +1801,7 @@ metadata = repository_metadata.metadata is_malicious = repository_metadata.malicious if is_malicious: - if trans.app.security_agent.can_push( trans.user, repository ): + if trans.app.security_agent.can_push( trans.app, trans.user, repository ): message += malicious_error_can_push else: message += malicious_error @@ -1896,7 +1897,7 @@ message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) repository = get_repository_in_tool_shed( trans, repository_id ) - changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) ) + changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip( trans.app ) ) ) repository_metadata = get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision ) if repository_metadata: repository_metadata_id = trans.security.encode_id( repository_metadata.id ), @@ -1935,7 +1936,7 @@ owner = params.get( 'owner', None ) changeset_revision = params.get( 'changeset_revision', None ) repository = get_repository_by_name_and_owner( trans, name, owner ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) # Get the lower bound changeset revision lower_bound_changeset_revision = get_previous_downloadable_changset_revision( repository, repo, changeset_revision ) @@ -1961,7 +1962,7 @@ message='Select a repository to rate', status='error' ) ) repository = get_repository_in_tool_shed( trans, id ) - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) if repository.user == trans.user: return trans.response.send_redirect( web.url_for( controller='repository', action='browse_repositories', @@ -1974,8 +1975,8 @@ avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model ) display_reviews = util.string_as_bool( params.get( 'display_reviews', False ) ) rra = self.get_user_item_rating( trans.sa_session, trans.user, repository, webapp_model=trans.model ) - is_malicious = changeset_is_malicious( trans, id, repository.tip ) - metadata = self.get_metadata( trans, id, repository.tip ) + is_malicious = changeset_is_malicious( trans, id, repository.tip( trans.app ) ) + metadata = self.get_metadata( trans, id, repository.tip( trans.app ) ) return trans.fill_template( '/webapps/community/repository/rate_repository.mako', repository=repository, metadata=metadata, @@ -1993,7 +1994,7 @@ invalid_file_tups, metadata_dict = reset_all_metadata_on_repository_in_tool_shed( trans, id, **kwd ) if invalid_file_tups: repository = get_repository_in_tool_shed( trans, id ) - message = generate_message_for_invalid_tools( invalid_file_tups, repository, metadata_dict ) + message = generate_message_for_invalid_tools( trans, invalid_file_tups, repository, metadata_dict ) status = 'error' else: message = "All repository metadata has been reset." @@ -2099,14 +2100,14 @@ status = params.get( 'status', 'done' ) commit_message = util.restore_text( params.get( 'commit_message', 'Deleted selected files' ) ) repository = get_repository_in_tool_shed( trans, id ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) selected_files_to_delete = util.restore_text( params.get( 'selected_files_to_delete', '' ) ) if params.get( 'select_files_to_delete_button', False ): if selected_files_to_delete: selected_files_to_delete = selected_files_to_delete.split( ',' ) # Get the current repository tip. - tip = repository.tip + tip = repository.tip( trans.app ) for selected_file in selected_files_to_delete: try: commands.remove( repo.ui, repo, selected_file, force=True ) @@ -2139,7 +2140,7 @@ update_repository( repo ) # Get the new repository tip. repo = hg.repository( get_configured_ui(), repo_dir ) - if tip == repository.tip: + if tip == repository.tip( trans.app ): message += 'No changes to repository. ' kwd[ 'message' ] = message @@ -2150,7 +2151,7 @@ else: message = "Select at least 1 file to delete from the repository before clicking <b>Delete selected files</b>." status = "error" - is_malicious = changeset_is_malicious( trans, id, repository.tip ) + is_malicious = changeset_is_malicious( trans, id, repository.tip( trans.app ) ) return trans.fill_template( '/webapps/community/repository/browse_repository.mako', repo=repo, repository=repository, @@ -2283,7 +2284,7 @@ message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) repository = get_repository_in_tool_shed( trans, id ) - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) changesets = [] for changeset in repo.changelog: ctx = repo.changectx( changeset ) @@ -2305,8 +2306,8 @@ 'has_metadata' : has_metadata } # Make sure we'll view latest changeset first. changesets.insert( 0, change_dict ) - is_malicious = changeset_is_malicious( trans, id, repository.tip ) - metadata = self.get_metadata( trans, id, repository.tip ) + is_malicious = changeset_is_malicious( trans, id, repository.tip( trans.app ) ) + metadata = self.get_metadata( trans, id, repository.tip( trans.app ) ) return trans.fill_template( '/webapps/community/repository/view_changelog.mako', repository=repository, metadata=metadata, @@ -2320,7 +2321,7 @@ message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) repository = get_repository_in_tool_shed( trans, id ) - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) ctx = get_changectx_for_changeset( repo, ctx_str ) if ctx is None: message = "Repository does not include changeset revision '%s'." % str( ctx_str ) @@ -2336,7 +2337,7 @@ diffs = [] for diff in patch.diff( repo, node1=ctx_parent.node(), node2=ctx.node() ): diffs.append( to_html_escaped( diff ) ) - is_malicious = changeset_is_malicious( trans, id, repository.tip ) + 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', repository=repository, @@ -2379,7 +2380,7 @@ metadata = None if metadata and 'readme' in metadata: readme_file = str( metadata[ 'readme' ] ) - repo_files_dir = repository.repo_path + repo_files_dir = repository.repo_path( trans.app ) try: f = open( readme_file, 'r' ) raw_text = f.read() @@ -2423,9 +2424,9 @@ status = params.get( 'status', 'done' ) cntrller = params.get( 'cntrller', 'repository' ) repository = get_repository_in_tool_shed( trans, id ) - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model ) - changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) ) + changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip( trans.app ) ) ) display_reviews = util.string_as_bool( params.get( 'display_reviews', False ) ) alerts = params.get( 'alerts', '' ) alerts_checked = CheckboxField.is_checked( alerts ) @@ -2464,9 +2465,9 @@ else: repository_metadata_id = None metadata = None - is_malicious = changeset_is_malicious( trans, id, repository.tip ) + is_malicious = changeset_is_malicious( trans, id, repository.tip( trans.app ) ) if is_malicious: - if trans.app.security_agent.can_push( trans.user, repository ): + if trans.app.security_agent.can_push( trans.app, trans.user, repository ): message += malicious_error_can_push else: message += malicious_error @@ -2505,7 +2506,7 @@ message = util.restore_text( params.get( 'message', '' ) ) status = params.get( 'status', 'done' ) repository = get_repository_in_tool_shed( trans, repository_id ) - repo_files_dir = repository.repo_path + repo_files_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_files_dir ) tool_metadata_dict = {} tool_lineage = [] @@ -2547,7 +2548,7 @@ tool_lineage = self.get_versions_of_tool( trans, repository, repository_metadata, guid ) else: metadata = None - is_malicious = changeset_is_malicious( trans, repository_id, repository.tip ) + is_malicious = changeset_is_malicious( trans, repository_id, repository.tip( trans.app ) ) changeset_revision_select_field = build_changeset_revision_select_field( trans, repository, selected_value=changeset_revision, @@ -2611,7 +2612,7 @@ # Restrict the options to all revisions that have associated metadata. repository_metadata_revisions = repository.metadata_revisions for repository_metadata in repository_metadata_revisions: - rev, label, changeset_revision = get_rev_label_changeset_revision_from_repository_metadata( repository_metadata, repository=repository ) + rev, label, changeset_revision = get_rev_label_changeset_revision_from_repository_metadata( trans, repository_metadata, repository=repository ) changeset_tups.append( ( rev, label, changeset_revision ) ) refresh_on_change_values.append( changeset_revision ) # Sort options by the revision label. Even though the downloadable_revisions query sorts by update_time, diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/controllers/repository_review.py --- a/lib/galaxy/webapps/community/controllers/repository_review.py +++ b/lib/galaxy/webapps/community/controllers/repository_review.py @@ -56,7 +56,7 @@ # Restrict to revisions that have been reviewed. if repository.reviews: rval = '' - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) for review in repository.reviews: changeset_revision = review.changeset_revision rev, label = get_rev_label_from_changeset_revision( repo, changeset_revision ) @@ -71,7 +71,9 @@ if repository_metadata_revisions: rval = '' for repository_metadata in repository_metadata_revisions: - rev, label, changeset_revision = get_rev_label_changeset_revision_from_repository_metadata( repository_metadata, repository=repository ) + rev, label, changeset_revision = get_rev_label_changeset_revision_from_repository_metadata( trans, + repository_metadata, + repository=repository ) rval += '<a href="manage_repository_reviews_of_revision' rval += '?id=%s&changeset_revision=%s">%s</a><br/>' % ( trans.security.encode_id( repository.id ), changeset_revision, label ) return rval @@ -309,7 +311,7 @@ status = params.get( 'status', 'done' ) review = get_review( trans, kwd[ 'id' ] ) repository = review.repository - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) rev, changeset_revision_label = get_rev_label_from_changeset_revision( repo, review.changeset_revision ) return trans.fill_template( '/webapps/community/repository_review/browse_review.mako', repository=repository, @@ -468,7 +470,7 @@ for component in get_components( trans ): components_dict[ component.name ] = dict( component=component, component_review=None ) repository = review.repository - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) for component_review in review.component_reviews: if component_review and component_review.component: component_name = component_review.component.name @@ -652,7 +654,7 @@ repository_id = kwd.get( 'id', None ) if repository_id: repository = get_repository_in_tool_shed( trans, repository_id ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) metadata_revision_hashes = [ metadata_revision.changeset_revision for metadata_revision in repository.metadata_revisions ] reviewed_revision_hashes = [ review.changeset_revision for review in repository.reviews ] @@ -699,7 +701,7 @@ repository_id = kwd.get( 'id', None ) changeset_revision = kwd.get( 'changeset_revision', None ) repository = get_repository_in_tool_shed( trans, repository_id ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) installable = changeset_revision in [ metadata_revision.changeset_revision for metadata_revision in repository.metadata_revisions ] rev, changeset_revision_label = get_rev_label_from_changeset_revision( repo, changeset_revision ) @@ -765,7 +767,7 @@ status = params.get( 'status', 'done' ) repository = get_repository_in_tool_shed( trans, kwd[ 'id' ] ) changeset_revision = kwd.get( 'changeset_revision', None ) - repo = hg.repository( get_configured_ui(), repository.repo_path ) + repo = hg.repository( get_configured_ui(), repository.repo_path( trans.app ) ) previous_reviews_dict = get_previous_repository_reviews( trans, repository, changeset_revision ) rev, changeset_revision_label = get_rev_label_from_changeset_revision( repo, changeset_revision ) return trans.fill_template( '/webapps/community/repository_review/select_previous_review.mako', diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/controllers/upload.py --- a/lib/galaxy/webapps/community/controllers/upload.py +++ b/lib/galaxy/webapps/community/controllers/upload.py @@ -31,19 +31,19 @@ categories = get_categories( trans ) repository_id = params.get( 'repository_id', '' ) repository = get_repository_in_tool_shed( trans, repository_id ) - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) uncompress_file = util.string_as_bool( params.get( 'uncompress_file', 'true' ) ) remove_repo_files_not_in_tar = util.string_as_bool( params.get( 'remove_repo_files_not_in_tar', 'true' ) ) uploaded_file = None upload_point = self.__get_upload_point( repository, **kwd ) - tip = repository.tip + tip = repository.tip( trans.app ) file_data = params.get( 'file_data', '' ) url = params.get( 'url', '' ) # Part of the upload process is sending email notification to those that have registered to # receive them. One scenario occurs when the first change set is produced for the repository. # See the handle_email_alerts() method for the definition of the scenarios. - new_repo_alert = repository.is_new + new_repo_alert = repository.is_new( trans.app ) uploaded_directory = None if params.get( 'upload_button', False ): if file_data == '' and url == '': @@ -158,7 +158,7 @@ # Update the repository files for browsing. update_repository( repo ) # Get the new repository tip. - if tip == repository.tip: + if tip == repository.tip( trans.app ): message = 'No changes to repository. ' status = 'warning' else: @@ -215,7 +215,7 @@ message=message, status=status ) def upload_directory( self, trans, repository, uploaded_directory, upload_point, remove_repo_files_not_in_tar, commit_message, new_repo_alert ): - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) undesirable_dirs_removed = 0 undesirable_files_removed = 0 @@ -251,7 +251,7 @@ return self.__handle_directory_changes(trans, repository, full_path, filenames_in_archive, remove_repo_files_not_in_tar, new_repo_alert, commit_message, undesirable_dirs_removed, undesirable_files_removed) def upload_tar( self, trans, repository, tar, uploaded_file, upload_point, remove_repo_files_not_in_tar, commit_message, new_repo_alert ): # Upload a tar archive of files. - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) undesirable_dirs_removed = 0 undesirable_files_removed = 0 @@ -284,12 +284,12 @@ uploaded_file.close() return self.__handle_directory_changes(trans, repository, full_path, filenames_in_archive, remove_repo_files_not_in_tar, new_repo_alert, commit_message, undesirable_dirs_removed, undesirable_files_removed) def __handle_directory_changes( self, trans, repository, full_path, filenames_in_archive, remove_repo_files_not_in_tar, new_repo_alert, commit_message, undesirable_dirs_removed, undesirable_files_removed ): - repo_dir = repository.repo_path + repo_dir = repository.repo_path( trans.app ) repo = hg.repository( get_configured_ui(), repo_dir ) content_alert_str = '' files_to_remove = [] filenames_in_archive = [ os.path.join( full_path, name ) for name in filenames_in_archive ] - if remove_repo_files_not_in_tar and not repository.is_new: + if remove_repo_files_not_in_tar and not repository.is_new( trans.app ): # We have a repository that is not new (it contains files), so discover # those files that are in the repository, but not in the uploaded archive. for root, dirs, files in os.walk( full_path ): diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/framework/middleware/remoteuser.py --- a/lib/galaxy/webapps/community/framework/middleware/remoteuser.py +++ b/lib/galaxy/webapps/community/framework/middleware/remoteuser.py @@ -53,8 +53,7 @@ if host in self.display_servers: environ[ 'HTTP_REMOTE_USER' ] = 'remote_display_server@%s' % ( self.maildomain or 'example.org' ) return self.app( environ, start_response ) - # Apache sets REMOTE_USER to the string '(null)' when using the - # Rewrite* method for passing REMOTE_USER and a user is + # Apache sets REMOTE_USER to the string '(null)' when using the Rewrite* method for passing REMOTE_USER and a user is # un-authenticated. Any other possible values need to go here as well. path_info = environ.get('PATH_INFO', '') if environ.has_key( 'HTTP_REMOTE_USER' ) and environ[ 'HTTP_REMOTE_USER' ] != '(null)': @@ -62,16 +61,14 @@ if self.maildomain is not None: environ[ 'HTTP_REMOTE_USER' ] += '@' + self.maildomain else: - title = "Access to Galaxy is denied" + title = "Access to this Galaxy tool shed is denied" message = """ - Galaxy is configured to authenticate users via an external - method (such as HTTP authentication in Apache), but only a - username (not an email address) was provided by the - upstream (proxy) server. Since Galaxy usernames are email - addresses, a default mail domain must be set.</p> - <p>Please contact your local Galaxy administrator. The - variable <code>remote_user_maildomain</code> must be set - before you may access Galaxy. + This Galaxy tool shed is configured to authenticate users via an external + method (such as HTTP authentication in Apache), but only a username (not + an email address) was provided by the upstream (proxy) server. Since tool + shed usernames are email addresses, a default mail domain must be set.</[> + <p>The variable <code>remote_user_maildomain</code> must be set before you + can access this tool shed. Contact your local tool shed administrator. """ return self.error( start_response, title, message ) return self.app( environ, start_response ) @@ -79,15 +76,15 @@ # The API handles its own authentication via keys return self.app( environ, start_response ) else: - title = "Access to Galaxy is denied" + title = "Access to this Galaxy tool shed is denied" message = """ - Galaxy is configured to authenticate users via an external - method (such as HTTP authentication in Apache), but a username - was not provided by the upstream (proxy) server. This is - generally due to a misconfiguration in the upstream server.</p> - <p>Please contact your local Galaxy administrator. + This Galaxy tool shed is configured to authenticate users via an external + method (such as HTTP authentication in Apache), but a username was not + provided by the upstream (proxy) server. This is generally due to a + misconfiguration in the upstream server.</p> + <p>Contact your local Galaxy tool shed administrator. """ return self.error( start_response, title, message ) - def error( self, start_response, title="Access denied", message="Please contact your local Galaxy administrator." ): + def error( self, start_response, title="Access denied", message="Contact your local Galaxy tool shed administrator." ): start_response( '403 Forbidden', [('Content-type', 'text/html')] ) return [errorpage % (title, message)] diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/model/__init__.py --- a/lib/galaxy/webapps/community/model/__init__.py +++ b/lib/galaxy/webapps/community/model/__init__.py @@ -6,6 +6,7 @@ """ import os.path, os, errno, sys, codecs, operator, logging, tarfile, mimetypes, ConfigParser from galaxy import util +from galaxy.util.shed_util import get_hgweb_config from galaxy.util.bunch import Bunch from galaxy.util.hash_util import * from galaxy.web.form_builder import * @@ -15,7 +16,7 @@ from mercurial import hg, ui log = logging.getLogger( __name__ ) - + class User( object ): def __init__( self, email=None, password=None ): self.email = email @@ -109,6 +110,10 @@ MARKED_FOR_REMOVAL = 'r', MARKED_FOR_ADDITION = 'a', NOT_TRACKED = '?' ) + # Handle to the hgweb.config file on disk. + hgweb_config_file = None + # This repository's entry in the hgweb.config file on disk. + hgweb_path = None def __init__( self, name=None, description=None, long_description=None, user_id=None, private=False, email_alerts=None, times_downloaded=0, deprecated=False ): self.name = name or "Unnamed repository" @@ -119,42 +124,43 @@ self.email_alerts = email_alerts self.times_downloaded = times_downloaded self.deprecated = deprecated - @property - def repo_path( self ): - # Repository locations on disk are defined in the hgweb.config file - # in the Galaxy install directory. An entry looks something like: - # repos/test/mira_assembler = database/community_files/000/repo_123 - # TODO: handle this using the mercurial api. - lhs = "repos/%s/%s" % ( self.user.username, self.name ) - hgweb_config = "%s/hgweb.config" % os.getcwd() - if not os.path.exists( hgweb_config ): - raise Exception( "Required file hgweb.config does not exist in directory %s" % os.getcwd() ) - config = ConfigParser.ConfigParser() - config.read( hgweb_config ) - for option in config.options( "paths" ): - if option == lhs: - return config.get( "paths", option ) - raise Exception( "Entry for repository %s missing in %s/hgweb.config file." % ( lhs, os.getcwd() ) ) - @property - def revision( self ): - repo = hg.repository( ui.ui(), self.repo_path ) + def get_hgweb_config_file( self, app ): + if self.hgweb_config_file is None: + self.hgweb_config_file = get_hgweb_config( app ) + return self.hgweb_config_file + def get_hgweb_path( self, app ): + # TODO: If possible, handle this using the mercurial api. + if self.hgweb_path is None: + lhs = os.path.join( "repos", self.user.username, self.name ) + config = ConfigParser.ConfigParser() + config.read( self.get_hgweb_config_file( app ) ) + for option in config.options( "paths" ): + if option == lhs: + self.hgweb_path = config.get( "paths", option ) + break + if self.hgweb_path is None: + raise Exception( "Entry for repository %s missing in file %s." % ( lhs, hgweb_config ) ) + return self.hgweb_path + def repo_path( self, app ): + # Repository locations on disk are stored in the hgweb.config file located in the directory defined by the config setting hgweb_config_dir. + # An entry looks something like: repos/test/mira_assembler = database/community_files/000/repo_123 + return self.get_hgweb_path( app ) + def revision( self, app ): + repo = hg.repository( ui.ui(), self.repo_path( app ) ) tip_ctx = repo.changectx( repo.changelog.tip() ) return "%s:%s" % ( str( tip_ctx.rev() ), str( repo.changectx( repo.changelog.tip() ) ) ) - @property - def tip( self ): - repo = hg.repository( ui.ui(), self.repo_path ) + def tip( self, app ): + repo = hg.repository( ui.ui(), self.repo_path( app ) ) return str( repo.changectx( repo.changelog.tip() ) ) - @property - def is_new( self ): - repo = hg.repository( ui.ui(), self.repo_path ) + def is_new( self, app ): + repo = hg.repository( ui.ui(), self.repo_path( app ) ) tip_ctx = repo.changectx( repo.changelog.tip() ) return tip_ctx.rev() < 0 - @property - def allow_push( self ): - repo = hg.repository( ui.ui(), self.repo_path ) + def allow_push( self, app ): + repo = hg.repository( ui.ui(), self.repo_path( app ) ) return repo.ui.config( 'web', 'allow_push' ) - def set_allow_push( self, usernames, remove_auth='' ): - allow_push = util.listify( self.allow_push ) + def set_allow_push( self, app, usernames, remove_auth='' ): + allow_push = util.listify( self.allow_push( app ) ) if remove_auth: allow_push.remove( remove_auth ) else: diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/model/mapping.py --- a/lib/galaxy/webapps/community/model/mapping.py +++ b/lib/galaxy/webapps/community/model/mapping.py @@ -315,7 +315,7 @@ result.engine = engine result.session = Session result.create_tables = create_tables - #load local galaxy security policy + # Load local tool shed security policy result.security_agent = CommunityRBACAgent( result ) result.shed_counter = ShedCounter( result ) return result diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b lib/galaxy/webapps/community/security/__init__.py --- a/lib/galaxy/webapps/community/security/__init__.py +++ b/lib/galaxy/webapps/community/security/__init__.py @@ -159,9 +159,9 @@ self.associate_components( user=user, role=role ) for group in groups: self.associate_components( user=user, group=group ) - def can_push( self, user, repository ): + def can_push( self, app, user, repository ): if user: - return user.username in listify( repository.allow_push ) + return user.username in listify( repository.allow_push( app ) ) return False def user_can_review_repositories( self, user ): if user: diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/admin/statistics.mako --- a/templates/webapps/community/admin/statistics.mako +++ b/templates/webapps/community/admin/statistics.mako @@ -18,10 +18,10 @@ <td>Total repositories</td><td>${trans.app.shed_counter.repositories | h}</td></tr> - <tr> - <td>Empty repositories</td> - <td>${trans.app.shed_counter.new_repositories | h}</td> - </tr> + ##<tr> + ## <td>Empty repositories</td> + ## <td>${trans.app.shed_counter.new_repositories | h}</td> + ##</tr><tr><td>Deleted repositories</td><td>${trans.app.shed_counter.deleted_repositories | h}</td> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/common/view_readme.mako --- a/templates/webapps/community/common/view_readme.mako +++ b/templates/webapps/community/common/view_readme.mako @@ -5,9 +5,9 @@ <% if trans.webapp.name == 'community': is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_rate = not is_new and trans.user and repository.user != trans.user can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) @@ -26,9 +26,9 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> %endif %if can_upload: <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/browse_repository.mako --- a/templates/webapps/community/repository/browse_repository.mako +++ b/templates/webapps/community/repository/browse_repository.mako @@ -6,9 +6,9 @@ <% from galaxy.web.framework.helpers import time_ago is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) can_browse_contents = not is_new @@ -70,15 +70,15 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> %endif %if can_upload: <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> %endif %if has_readme: - <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View README</a> %endif %if can_view_change_log: <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> @@ -87,9 +87,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> %endif </div> %endif @@ -101,7 +101,7 @@ %if can_browse_contents: <div class="toolForm"> - <div class="toolFormTitle">Browse ${repository.name | h} revision ${repository.tip | h} (repository tip)</div> + <div class="toolFormTitle">Browse ${repository.name | h} revision ${repository.tip( trans.app ) | h} (repository tip)</div> %if can_download: <div class="form-row"><label>Clone this repository:</label> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/common.mako --- a/templates/webapps/community/repository/common.mako +++ b/templates/webapps/community/repository/common.mako @@ -22,7 +22,7 @@ // initAjax is hard to fake, so we pass the children as object array: initAjax: {url: "${h.url_for( controller='repository', action='open_folder' )}", dataType: "json", - data: { folder_path: "${repository.repo_path}" }, + data: { folder_path: "${repository.repo_path( trans.app )}" }, }, onLazyRead: function(dtnode){ dtnode.appendAjax({ @@ -51,7 +51,7 @@ var cell = $("#file_contents"); var selected_value; if (dtnode.data.key == 'root') { - selected_value = "${repository.repo_path}/"; + selected_value = "${repository.repo_path( trans.app )}/"; } else { selected_value = dtnode.data.key; }; diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/contact_owner.mako --- a/templates/webapps/community/repository/contact_owner.mako +++ b/templates/webapps/community/repository/contact_owner.mako @@ -3,9 +3,9 @@ <% is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) can_browse_contents = not is_new @@ -44,7 +44,7 @@ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> %endif %if has_readme: - <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View README</a> %endif %if can_view_change_log: <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> @@ -53,9 +53,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label | h}</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> %endif </div> %endif diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/manage_repository.mako --- a/templates/webapps/community/repository/manage_repository.mako +++ b/templates/webapps/community/repository/manage_repository.mako @@ -6,10 +6,10 @@ <% from galaxy.web.framework.helpers import time_ago is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) is_deprecated = repository.deprecated can_contact_owner = trans.user and trans.user != repository.user - can_push = not is_deprecated and trans.app.security_agent.can_push( trans.user, repository ) + can_push = not is_deprecated and trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_upload = can_push can_download = not is_deprecated and not is_new and ( not is_malicious or can_push ) can_browse_contents = not is_new @@ -20,14 +20,14 @@ browse_label = 'Browse or delete repository tip files' else: browse_label = 'Browse repository tip files' - can_set_malicious = metadata and can_set_metadata and is_admin and changeset_revision == repository.tip + can_set_malicious = metadata and can_set_metadata and is_admin and changeset_revision == repository.tip( trans.app ) can_deprecate = not is_new and trans.user and ( is_admin or repository.user == trans.user ) and not is_deprecated can_undeprecate = trans.user and ( is_admin or repository.user == trans.user ) and is_deprecated can_reset_all_metadata = not is_deprecated and is_admin and len( repo ) > 0 has_readme = metadata and 'readme' in metadata can_review_repository = not is_deprecated and trans.app.security_agent.user_can_review_repositories( trans.user ) reviewing_repository = cntrller and cntrller == 'repository_review' - if changeset_revision == repository.tip: + if changeset_revision == repository.tip( trans.app ): tip_str = 'repository tip' else: tip_str = '' @@ -191,7 +191,7 @@ %if is_admin: <div class="form-row"><label>Location:</label> - ${repository.repo_path | h} + ${repository.repo_path( trans.app ) | h} </div><div class="form-row"><label>Deleted:</label> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/preview_tools_in_changeset.mako --- a/templates/webapps/community/repository/preview_tools_in_changeset.mako +++ b/templates/webapps/community/repository/preview_tools_in_changeset.mako @@ -4,9 +4,9 @@ <%namespace file="/webapps/community/repository/common.mako" import="*" /><% - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_rate = not is_new and trans.user and repository.user != trans.user can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) @@ -59,7 +59,7 @@ <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=trans.security.encode_id( repository.id ) )}" method="post" ><div class="form-row"><% - if changeset_revision == repository.tip: + if changeset_revision == repository.tip( trans.app ): tip_str = 'repository tip' else: tip_str = '' diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/rate_repository.mako --- a/templates/webapps/community/repository/rate_repository.mako +++ b/templates/webapps/community/repository/rate_repository.mako @@ -6,9 +6,9 @@ from galaxy.web.framework.helpers import time_ago from urllib import quote_plus is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) can_browse_contents = not is_new @@ -77,15 +77,15 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> %endif %if can_upload: <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> %endif %if has_readme: - <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View README</a> %endif %if can_view_change_log: <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> @@ -97,9 +97,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> %endif </div> %endif @@ -122,7 +122,7 @@ </div><div class="form-row"><label>Version:</label> - ${repository.revision | h} + ${repository.revision( trans.app ) | h} <div style="clear: both"></div></div><div class="form-row"> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/tool_form.mako --- a/templates/webapps/community/repository/tool_form.mako +++ b/templates/webapps/community/repository/tool_form.mako @@ -8,9 +8,9 @@ from galaxy.web.form_builder import SelectField is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) can_browse_contents = not is_new diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/upload.mako --- a/templates/webapps/community/repository/upload.mako +++ b/templates/webapps/community/repository/upload.mako @@ -3,7 +3,7 @@ <% is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_browse_contents = not is_new can_browse_contents = not is_new can_rate = repository.user != trans.user @@ -48,9 +48,9 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> %endif %if can_view_change_log: <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> @@ -154,7 +154,7 @@ </div><div style="clear: both"></div></div> - %if not repository.is_new: + %if not repository.is_new( trans.app ): <div class="form-row" ><label>Contents:</label><div id="tree" > diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/view_changelog.mako --- a/templates/webapps/community/repository/view_changelog.mako +++ b/templates/webapps/community/repository/view_changelog.mako @@ -6,11 +6,11 @@ <% from galaxy.web.framework.helpers import time_ago is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_contact_owner = trans.user and trans.user != repository.user can_browse_contents = not is_new can_manage = is_admin or trans.user == repository.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_rate = trans.user and repository.user != trans.user can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) @@ -48,12 +48,12 @@ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> %endif %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> %endif %if has_readme: - <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View README</a> %endif %if can_rate: <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.security.encode_id( repository.id ) )}">Rate repository</a> @@ -65,9 +65,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> %endif </div></ul> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/view_changeset.mako --- a/templates/webapps/community/repository/view_changeset.mako +++ b/templates/webapps/community/repository/view_changeset.mako @@ -6,12 +6,12 @@ <% from galaxy.web.framework.helpers import time_ago is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_contact_owner = trans.user and trans.user != repository.user can_browse_contents = not is_new can_rate = trans.user and repository.user != trans.user can_manage = is_admin or trans.user == repository.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_view_change_log = not is_new can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) @@ -49,12 +49,12 @@ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> %endif %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> %endif %if has_readme: - <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View README</a> %endif %if can_view_change_log: <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a> @@ -69,9 +69,9 @@ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a> %endif %if can_download: - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='bz2' )}">Download as a .tar.bz2 file</a> - <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='zip' )}">Download as a zip file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='gz' )}">Download as a .tar.gz file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='bz2' )}">Download as a .tar.bz2 file</a> + <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ), file_type='zip' )}">Download as a zip file</a> %endif </div></ul> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/view_repository.mako --- a/templates/webapps/community/repository/view_repository.mako +++ b/templates/webapps/community/repository/view_repository.mako @@ -5,10 +5,10 @@ <% from galaxy.web.framework.helpers import time_ago - is_new = repository.is_new + is_new = repository.is_new( trans.app ) is_deprecated = repository.deprecated can_contact_owner = trans.user and trans.user != repository.user - can_push = not is_deprecated and trans.app.security_agent.can_push( trans.user, repository ) + can_push = not is_deprecated and trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_rate = not is_deprecated and not is_new and trans.user and repository.user != trans.user can_upload = can_push can_download = not is_deprecated and not is_new and ( not is_malicious or can_push ) @@ -114,7 +114,7 @@ <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ) )}" method="post" ><div class="form-row"><% - if changeset_revision == repository.tip: + if changeset_revision == repository.tip( trans.app ): tip_str = 'repository tip' else: tip_str = '' @@ -172,7 +172,7 @@ %if trans.user_is_admin(): <div class="form-row"><label>Location:</label> - ${repository.repo_path | h} + ${repository.repo_path( trans.app ) | h} </div><div class="form-row"><label>Deleted:</label> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/view_tool_metadata.mako --- a/templates/webapps/community/repository/view_tool_metadata.mako +++ b/templates/webapps/community/repository/view_tool_metadata.mako @@ -7,9 +7,9 @@ from galaxy.web.framework.helpers import time_ago from urllib import quote_plus is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_contact_owner = trans.user and trans.user != repository.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_upload = can_push can_download = not is_new and ( not is_malicious or can_push ) can_browse_contents = trans.webapp.name == 'community' and not is_new diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository/view_workflow.mako --- a/templates/webapps/community/repository/view_workflow.mako +++ b/templates/webapps/community/repository/view_workflow.mako @@ -9,10 +9,10 @@ in_tool_shed = trans.webapp.name == 'community' is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_manage = is_admin or trans.user == repository.user can_contact_owner = in_tool_shed and trans.user and trans.user != repository.user - can_push = in_tool_shed and trans.app.security_agent.can_push( trans.user, repository ) + can_push = in_tool_shed and trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_upload = can_push can_download = in_tool_shed and not is_new and ( not is_malicious or can_push ) can_browse_contents = in_tool_shed and not is_new @@ -51,9 +51,9 @@ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a> %endif %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> %endif %if has_readme: <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View README</a> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository_review/reviews_of_changeset_revision.mako --- a/templates/webapps/community/repository_review/reviews_of_changeset_revision.mako +++ b/templates/webapps/community/repository_review/reviews_of_changeset_revision.mako @@ -7,11 +7,11 @@ from galaxy.webapps.community.controllers.repository_review import build_approved_select_field from galaxy.webapps.community.controllers.common import STRSEP is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_browse_contents = not is_new can_contact_owner = trans.user and trans.user != repository.user can_manage = is_admin or repository.user == trans.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_rate = not is_new and trans.user and repository.user != trans.user can_view_change_log = not is_new if can_push: diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository_review/reviews_of_repository.mako --- a/templates/webapps/community/repository_review/reviews_of_repository.mako +++ b/templates/webapps/community/repository_review/reviews_of_repository.mako @@ -5,11 +5,11 @@ <% is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_browse_contents = not is_new can_contact_owner = trans.user and trans.user != repository.user can_manage = is_admin or repository.user == trans.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_rate = not is_new and trans.user and repository.user != trans.user can_view_change_log = not is_new if can_push: @@ -44,9 +44,9 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> %endif %if can_view_change_log: <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.security.encode_id( repository.id ) )}">View change log</a> diff -r 15543df2c2428ffadbce946433ae43edff8cb197 -r d60deede2b6a1d360bfd7479a68ab72eb162e84b templates/webapps/community/repository_review/select_previous_review.mako --- a/templates/webapps/community/repository_review/select_previous_review.mako +++ b/templates/webapps/community/repository_review/select_previous_review.mako @@ -5,11 +5,11 @@ <% is_admin = trans.user_is_admin() - is_new = repository.is_new + is_new = repository.is_new( trans.app ) can_browse_contents = not is_new can_contact_owner = trans.user and trans.user != repository.user can_manage = is_admin or repository.user == trans.user - can_push = trans.app.security_agent.can_push( trans.user, repository ) + can_push = trans.app.security_agent.can_push( trans.app, trans.user, repository ) can_rate = not is_new and trans.user and repository.user != trans.user can_view_change_log = not is_new if can_push: @@ -43,9 +43,9 @@ <li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup"> %if can_manage: - <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">Manage repository</a> %else: - <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a> + <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip( trans.app ) )}">View repository</a> %endif %if can_view_change_log: <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.security.encode_id( repository.id ) )}">View change log</a> 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.