galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
November 2012
- 1 participants
- 133 discussions
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/424d407c67f7/
changeset: 424d407c67f7
user: inithello
date: 2012-11-13 19:56:59
summary: Fix for renaming repository.
affected #: 1 file
diff -r 447448028a2f7326fc452ee32055de5c58e822f6 -r 424d407c67f7ea4f830317b7ab033815415a5a3b lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -1676,8 +1676,7 @@
# Change the entry in the hgweb.config file for the repository.
old_lhs = "repos/%s/%s" % ( repository.user.username, repository.name )
new_lhs = "repos/%s/%s" % ( repository.user.username, repo_name )
- new_rhs = "%s\n" % repo_dir
- trans.app.hgweb_config_manager.change_entry( old_lhs, new_lhs, new_rhs )
+ trans.app.hgweb_config_manager.change_entry( old_lhs, new_lhs, repo_dir )
# Change the entry in the repository's hgrc file.
hgrc_file = os.path.join( repo_dir, '.hg', 'hgrc' )
self.__change_repository_name_in_hgrc_file( hgrc_file, repo_name )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Add the framework components to enable creating a functional test framework for the tool shed.
by Bitbucket 13 Nov '12
by Bitbucket 13 Nov '12
13 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/447448028a2f/
changeset: 447448028a2f
user: greg
date: 2012-11-13 19:49:09
summary: Add the framework components to enable creating a functional test framework for the tool shed.
affected #: 9 files
diff -r 3419a45c1f01790b3108d1726253fcb46feedbf4 -r 447448028a2f7326fc452ee32055de5c58e822f6 run_tool_shed_functional_tests.sh
--- /dev/null
+++ b/run_tool_shed_functional_tests.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# A good place to look for nose info: http://somethingaboutorange.com/mrl/projects/nose/
+#rm -f ./test/tool_shed/run_functional_tests.log
+
+if [ ! $1 ]; then
+ python ./test/tool_shed/functional_tests.py -v --with-nosehtml --html-report-file ./test/tool_shed/run_functional_tests.html ./test/tool_shed/functional
+elif [ $1 = 'help' ]; then
+ echo "'run_tool_shed_functional_tests.sh' for running all the test scripts in the ./test/tool_shed/functional directory"
+ echo "'run_tool_shed_functional_tests.sh testscriptname' for running one test script named testscriptname in the .test/tool_shed/functional directory"
+else
+ python ./test/tool_shed/functional_tests.py -v --with-nosehtml --html-report-file ./test/tool_shed/run_functional_tests.html $1
+fi
+
+echo "'sh run_tool_shed_functional_tests.sh help' for help"
diff -r 3419a45c1f01790b3108d1726253fcb46feedbf4 -r 447448028a2f7326fc452ee32055de5c58e822f6 test/tool_shed/__init__.py
--- /dev/null
+++ b/test/tool_shed/__init__.py
@@ -0,0 +1,1 @@
+"""Tool shed functional Tests"""
\ No newline at end of file
diff -r 3419a45c1f01790b3108d1726253fcb46feedbf4 -r 447448028a2f7326fc452ee32055de5c58e822f6 test/tool_shed/base/test_db_util.py
--- /dev/null
+++ b/test/tool_shed/base/test_db_util.py
@@ -0,0 +1,39 @@
+import galaxy.webapps.community.model as model
+from galaxy.model.orm import *
+from galaxy.webapps.community.model.mapping import context as sa_session
+from base.twilltestcase import *
+import sys
+
+def delete_obj( obj ):
+ sa_session.delete( obj )
+ sa_session.flush()
+def delete_user_roles( user ):
+ for ura in user.roles:
+ sa_session.delete( ura )
+ sa_session.flush()
+def flush( obj ):
+ sa_session.add( obj )
+ sa_session.flush()
+def get_default_user_permissions_by_role( role ):
+ return sa_session.query( model.DefaultUserPermissions ) \
+ .filter( model.DefaultUserPermissions.table.c.role_id == role.id ) \
+ .all()
+def get_default_user_permissions_by_user( user ):
+ return sa_session.query( model.DefaultUserPermissions ) \
+ .filter( model.DefaultUserPermissions.table.c.user_id==user.id ) \
+ .all()
+def get_private_role( user ):
+ for role in user.all_roles():
+ if role.name == user.email and role.description == 'Private Role for %s' % user.email:
+ return role
+ raise AssertionError( "Private role not found for user '%s'" % user.email )
+def get_user( email ):
+ return sa_session.query( model.User ) \
+ .filter( model.User.table.c.email==email ) \
+ .first()
+def mark_obj_deleted( obj ):
+ obj.deleted = True
+ sa_session.add( obj )
+ sa_session.flush()
+def refresh( obj ):
+ sa_session.refresh( obj )
diff -r 3419a45c1f01790b3108d1726253fcb46feedbf4 -r 447448028a2f7326fc452ee32055de5c58e822f6 test/tool_shed/base/twilltestcase.py
--- /dev/null
+++ b/test/tool_shed/base/twilltestcase.py
@@ -0,0 +1,20 @@
+from base.twilltestcase import *
+
+class ShedTwillTestCase( TwillTestCase ):
+ def setUp( self ):
+ # Security helper
+ self.security = security.SecurityHelper( id_secret='changethisinproductiontoo' )
+ self.history_id = None
+ self.host = os.environ.get( 'TOOL_SHED_TEST_HOST' )
+ self.port = os.environ.get( 'TOOL_SHED_TEST_PORT' )
+ self.url = "http://%s:%s" % ( self.host, self.port )
+ self.file_dir = os.environ.get( 'TOOL_SHED_TEST_FILE_DIR', None )
+ self.tool_shed_test_file = None
+ self.shed_tools_dict = {}
+ self.keepOutdir = os.environ.get( 'TOOL_SHED_TEST_SAVE', '' )
+ if self.keepOutdir > '':
+ try:
+ os.makedirs( self.keepOutdir )
+ except:
+ pass
+ self.home()
diff -r 3419a45c1f01790b3108d1726253fcb46feedbf4 -r 447448028a2f7326fc452ee32055de5c58e822f6 test/tool_shed/functional/test_0000_create_repository.py
--- /dev/null
+++ b/test/tool_shed/functional/test_0000_create_repository.py
@@ -0,0 +1,44 @@
+import tempfile, time, re, tempfile, os, shutil
+import galaxy.webapps.community.model
+from galaxy.util import parse_xml, string_as_bool
+from galaxy.util.shed_util import clean_tool_shed_url
+from galaxy.model.orm import *
+from tool_shed.base.twilltestcase import *
+from tool_shed.base.test_db_util import *
+
+admin_user = None
+admin_user_private_role = None
+admin_email = 'test(a)bx.psu.edu'
+admin_username = 'admin-user'
+
+class TestCreateRepository( ShedTwillTestCase ):
+
+ def test_0000_initiate_users( self ):
+ """Create necessary users and login as an admin user."""
+ self.logout()
+ self.login( email=admin_email, username=admin_username )
+ admin_user = get_user( admin_email )
+ assert admin_user is not None, 'Problem retrieving user with email %s from the database' % admin_email
+ admin_user_private_role = get_private_role( admin_user )
+ def test_0005_create_category( self ):
+ """Create a category"""
+ self.visit_url( '/admin/manage_categories?operation=create' )
+ try:
+ tc.fv( "1", "name", "Text Manipulation" )
+ tc.fv( "1", "description", "Tools for manipulating text" )
+ tc.submit( "create_category_button" )
+ except Exception, e:
+ errmsg = "Problem creating a category: %s" % str( e )
+ raise AssertionError( e )
+ def test_0010_create_filter_repository( self ):
+ """Create a repository"""
+ self.visit_url( '/repository/create_repository' )
+ try:
+ tc.fv( "1", "name", "filter" )
+ tc.fv( "1", "description", "Galaxy's filter tool" )
+ tc.fv( "1", "long_description", "Long description of Galaxy's filter tool" )
+ tc.fv( "1", "category_id", "Text Manipulation" )
+ tc.submit( "create_repository_button" )
+ except Exception, e:
+ errmsg = "Problem creating a repository: %s" % str( e )
+ raise AssertionError( e )
diff -r 3419a45c1f01790b3108d1726253fcb46feedbf4 -r 447448028a2f7326fc452ee32055de5c58e822f6 test/tool_shed/functional_tests.py
--- /dev/null
+++ b/test/tool_shed/functional_tests.py
@@ -0,0 +1,274 @@
+#!/usr/bin/env python
+
+import os, sys, shutil, tempfile, re
+
+# Assume we are run from the galaxy root directory, add lib to the python path
+cwd = os.getcwd()
+tool_shed_home_directory = os.path.join( cwd, 'test', 'tool_shed' )
+default_tool_shed_test_file_dir = os.path.join( tool_shed_home_directory, 'test_data' )
+new_path = [ os.path.join( cwd, "lib" ) ]
+new_path.extend( sys.path[1:] )
+sys.path = new_path
+
+from galaxy import eggs
+
+eggs.require( "nose" )
+eggs.require( "NoseHTML" )
+eggs.require( "NoseTestDiff" )
+eggs.require( "twill==0.9" )
+eggs.require( "Paste" )
+eggs.require( "PasteDeploy" )
+eggs.require( "Cheetah" )
+
+# This should not be required, but it is under certain conditions, thanks to this bug: http://code.google.com/p/python-nose/issues/detail?id=284
+eggs.require( "pysqlite" )
+
+import atexit, logging, os, os.path, sys, tempfile
+import twill, unittest, time
+import sys, threading, random
+import httplib, socket
+from paste import httpserver
+import galaxy.webapps.community.app
+from galaxy.webapps.community.app import UniverseApplication
+from galaxy.webapps.community import buildapp
+
+import nose.core
+import nose.config
+import nose.loader
+import nose.plugins.manager
+
+log = logging.getLogger( "tool_shed_functional_tests.py" )
+
+default_tool_shed_test_host = "localhost"
+default_tool_shed_test_port_min = 8000
+default_tool_shed_test_port_max = 9999
+default_tool_shed_locales = 'en'
+
+def run_tests( test_config ):
+ loader = nose.loader.TestLoader( config=test_config )
+ plug_loader = test_config.plugins.prepareTestLoader( loader )
+ if plug_loader is not None:
+ loader = plug_loader
+ tests = loader.loadTestsFromNames( test_config.testNames )
+ test_runner = nose.core.TextTestRunner( stream=test_config.stream,
+ verbosity=test_config.verbosity,
+ config=test_config )
+ plug_runner = test_config.plugins.prepareTestRunner( test_runner )
+ if plug_runner is not None:
+ test_runner = plug_runner
+ return test_runner.run( tests )
+
+def main():
+ # ---- Configuration ------------------------------------------------------
+ tool_shed_test_host = os.environ.get( 'TOOL_SHED_TEST_HOST', default_tool_shed_test_host )
+ tool_shed_test_port = os.environ.get( 'TOOL_SHED_TEST_PORT', None )
+ tool_shed_test_save = os.environ.get( 'TOOL_SHED_TEST_SAVE', None )
+ tool_path = os.environ.get( 'TOOL_SHED_TEST_TOOL_PATH', 'tools' )
+ start_server = 'TOOL_SHED_TEST_EXTERNAL' not in os.environ
+ if 'HTTP_ACCEPT_LANGUAGE' not in os.environ:
+ os.environ[ 'HTTP_ACCEPT_LANGUAGE' ] = default_tool_shed_locales
+ tool_shed_test_file_dir = os.environ.get( 'TOOL_SHED_TEST_FILE_DIR', default_tool_shed_test_file_dir )
+ if not os.path.isabs( tool_shed_test_file_dir ):
+ tool_shed_test_file_dir = tool_shed_test_file_dir
+ ignore_files = ()
+ if os.path.exists( 'tool_data_table_conf.test.xml' ):
+ tool_data_table_config_path = 'tool_data_table_conf.test.xml'
+ else:
+ tool_data_table_config_path = 'tool_data_table_conf.xml'
+ shed_tool_data_table_config = 'shed_tool_data_table_conf.xml'
+ tool_dependency_dir = os.environ.get( 'TOOL_SHED_TOOL_DEPENDENCY_DIR', None )
+ use_distributed_object_store = os.environ.get( 'TOOL_SHED_USE_DISTRIBUTED_OBJECT_STORE', False )
+
+ if start_server:
+ psu_production = False
+ tool_shed_test_proxy_port = None
+ if 'TOOL_SHED_TEST_PSU_PRODUCTION' in os.environ:
+ if not tool_shed_test_port:
+ raise Exception( 'Set TOOL_SHED_TEST_PORT to the port to which the proxy server will proxy' )
+ tool_shed_test_proxy_port = os.environ.get( 'TOOL_SHED_TEST_PROXY_PORT', None )
+ if not tool_shed_test_proxy_port:
+ raise Exception( 'Set TOOL_SHED_TEST_PROXY_PORT to the port on which the proxy server is listening' )
+ base_file_path = os.environ.get( 'TOOL_SHED_TEST_BASE_FILE_PATH', None )
+ if not base_file_path:
+ raise Exception( 'Set TOOL_SHED_TEST_BASE_FILE_PATH to the directory which will contain the dataset files directory' )
+ base_new_file_path = os.environ.get( 'TOOL_SHED_TEST_BASE_NEW_FILE_PATH', None )
+ if not base_new_file_path:
+ raise Exception( 'Set TOOL_SHED_TEST_BASE_NEW_FILE_PATH to the directory which will contain the temporary directory' )
+ database_connection = os.environ.get( 'TOOL_SHED_TEST_DBURI', None )
+ if not database_connection:
+ raise Exception( 'Set TOOL_SHED_TEST_DBURI to the URI of the database to be used for tests' )
+ nginx_upload_store = os.environ.get( 'TOOL_SHED_TEST_NGINX_UPLOAD_STORE', None )
+ if not nginx_upload_store:
+ raise Exception( 'Set TOOL_SHED_TEST_NGINX_UPLOAD_STORE to the path where the nginx upload module places uploaded files' )
+ file_path = tempfile.mkdtemp( dir=base_file_path )
+ new_file_path = tempfile.mkdtemp( dir=base_new_file_path )
+ kwargs = dict( database_engine_option_pool_size = '10',
+ database_engine_option_max_overflow = '20',
+ database_engine_option_strategy = 'threadlocal',
+ static_enabled = 'False',
+ debug = 'False' )
+ psu_production = True
+ else:
+ if 'TOOL_SHED_TEST_DBPATH' in os.environ:
+ db_path = os.environ[ 'TOOL_SHED_TEST_DBPATH' ]
+ else:
+ tempdir = tempfile.mkdtemp()
+ db_path = os.path.join( tempdir, 'database' )
+ file_path = os.path.join( db_path, 'files' )
+ new_file_path = os.path.join( db_path, 'tmp' )
+ if 'TOOL_SHED_TEST_DBURI' in os.environ:
+ database_connection = os.environ[ 'TOOL_SHED_TEST_DBURI' ]
+ else:
+ database_connection = 'sqlite:///' + os.path.join( db_path, 'universe.sqlite' )
+ kwargs = {}
+ for dir in file_path, new_file_path:
+ try:
+ os.makedirs( dir )
+ except OSError:
+ pass
+
+ print "Database connection:", database_connection
+
+ # ---- Build Application --------------------------------------------------
+ app = None
+ if start_server:
+ global_conf = { '__file__' : 'community_wsgi.ini.sample' }
+ if psu_production:
+ global_conf = None
+ if not database_connection.startswith( 'sqlite://' ):
+ kwargs[ 'database_engine_option_max_overflow' ] = '20'
+ if tool_dependency_dir is not None:
+ kwargs[ 'tool_dependency_dir' ] = tool_dependency_dir
+ if use_distributed_object_store:
+ kwargs[ 'object_store' ] = 'distributed'
+ kwargs[ 'distributed_object_store_config_file' ] = 'distributed_object_store_conf.xml.sample'
+
+ app = UniverseApplication( job_queue_workers = 5,
+ id_secret = 'changethisinproductiontoo',
+ template_path = 'templates',
+ database_connection = database_connection,
+ database_engine_option_pool_size = '10',
+ file_path = file_path,
+ new_file_path = new_file_path,
+ tool_path=tool_path,
+ datatype_converters_config_file = 'datatype_converters_conf.xml.sample',
+ tool_parse_help = False,
+ tool_data_table_config_path = tool_data_table_config_path,
+ shed_tool_data_table_config = shed_tool_data_table_config,
+ log_destination = "stdout",
+ use_heartbeat = False,
+ allow_user_creation = True,
+ allow_user_deletion = True,
+ admin_users = 'test(a)bx.psu.edu',
+ global_conf = global_conf,
+ running_functional_tests = True,
+ hgweb_config_dir = new_file_path,
+ **kwargs )
+ log.info( "Embedded Universe application started" )
+
+ # ---- Run webserver ------------------------------------------------------
+ server = None
+ if start_server:
+ webapp = buildapp.app_factory( dict( database_file=database_connection ),
+ use_translogger=False,
+ static_enabled=False,
+ app=app )
+ if tool_shed_test_port is not None:
+ server = httpserver.serve( webapp, host=tool_shed_test_host, port=tool_shed_test_port, start_loop=False )
+ else:
+ random.seed()
+ for i in range( 0, 9 ):
+ try:
+ tool_shed_test_port = str( random.randint( default_tool_shed_test_port_min, default_tool_shed_test_port_max ) )
+ log.debug( "Attempting to serve app on randomly chosen port: %s" % tool_shed_test_port )
+ server = httpserver.serve( webapp, host=tool_shed_test_host, port=tool_shed_test_port, start_loop=False )
+ break
+ except socket.error, e:
+ if e[0] == 98:
+ continue
+ raise
+ else:
+ raise Exception( "Unable to open a port between %s and %s to start Galaxy server" % ( default_tool_shed_test_port_min, default_tool_shed_test_port_max ) )
+ if tool_shed_test_proxy_port:
+ os.environ[ 'TOOL_SHED_TEST_PORT' ] = tool_shed_test_proxy_port
+ else:
+ os.environ[ 'TOOL_SHED_TEST_PORT' ] = tool_shed_test_port
+ t = threading.Thread( target=server.serve_forever )
+ t.start()
+ # Test if the server is up
+ for i in range( 10 ):
+ # Directly test the app, not the proxy.
+ conn = httplib.HTTPConnection( tool_shed_test_host, tool_shed_test_port )
+ conn.request( "GET", "/" )
+ if conn.getresponse().status == 200:
+ break
+ time.sleep( 0.1 )
+ else:
+ raise Exception( "Test HTTP server did not return '200 OK' after 10 tries" )
+ # Test if the proxy server is up.
+ if psu_production:
+ # Directly test the app, not the proxy.
+ conn = httplib.HTTPConnection( tool_shed_test_host, tool_shed_test_proxy_port )
+ conn.request( "GET", "/" )
+ if not conn.getresponse().status == 200:
+ raise Exception( "Test HTTP proxy server did not return '200 OK'" )
+ log.info( "Embedded web server started" )
+ # We don't add the tests to the path until everything is up and running
+ new_path = [ os.path.join( cwd, 'test' ) ]
+ new_path.extend( sys.path[1:] )
+ sys.path = new_path
+ # ---- Find tests ---------------------------------------------------------
+ if tool_shed_test_proxy_port:
+ log.info( "Functional tests will be run against %s:%s" % ( tool_shed_test_host, tool_shed_test_proxy_port ) )
+ else:
+ log.info( "Functional tests will be run against %s:%s" % ( tool_shed_test_host, tool_shed_test_port ) )
+ success = False
+ try:
+ # What requires these? Handy for (eg) functional tests to save outputs?
+ if tool_shed_test_save:
+ os.environ[ 'TOOL_SHED_TEST_SAVE' ] = tool_shed_test_save
+ # Pass in through script set env, will leave a copy of ALL test validate files.
+ os.environ[ 'TOOL_SHED_TEST_HOST' ] = tool_shed_test_host
+ if tool_shed_test_file_dir:
+ os.environ[ 'TOOL_SHED_TEST_FILE_DIR' ] = tool_shed_test_file_dir
+ test_config = nose.config.Config( env=os.environ, ignoreFiles=ignore_files, plugins=nose.plugins.manager.DefaultPluginManager() )
+ test_config.configure( sys.argv )
+ # Run the tests.
+ result = run_tests( test_config )
+ success = result.wasSuccessful()
+ except:
+ log.exception( "Failure running tests" )
+
+ log.info( "Shutting down" )
+ # ---- Tear down -----------------------------------------------------------
+ if server:
+ log.info( "Shutting down embedded web server" )
+ server.server_close()
+ server = None
+ log.info( "Embedded web server stopped" )
+ if app:
+ log.info( "Shutting down app" )
+ app.shutdown()
+ app = None
+ log.info( "Embedded Universe application stopped" )
+ try:
+ if os.path.exists( tempdir ) and 'TOOL_SHED_TEST_NO_CLEANUP' not in os.environ:
+ log.info( "Cleaning up temporary files in %s" % tempdir )
+ shutil.rmtree( tempdir )
+ except:
+ pass
+ if psu_production and 'TOOL_SHED_TEST_NO_CLEANUP' not in os.environ:
+ for dir in ( file_path, new_file_path ):
+ try:
+ if os.path.exists( dir ):
+ log.info( 'Cleaning up temporary files in %s' % dir )
+ shutil.rmtree( dir )
+ except:
+ pass
+ if success:
+ return 0
+ else:
+ return 1
+
+if __name__ == "__main__":
+ sys.exit( main() )
diff -r 3419a45c1f01790b3108d1726253fcb46feedbf4 -r 447448028a2f7326fc452ee32055de5c58e822f6 test/tool_shed/test_data/filtering_1.1.0.tar
Binary file test/tool_shed/test_data/filtering_1.1.0.tar has changed
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Create a new, empty hgweb.config file if one isn't found in the configured location.
by Bitbucket 13 Nov '12
by Bitbucket 13 Nov '12
13 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/3419a45c1f01/
changeset: 3419a45c1f01
user: greg
date: 2012-11-13 19:45:03
summary: Create a new, empty hgweb.config file if one isn't found in the configured location.
affected #: 2 files
diff -r 4471a94e8fbff8d8c165c58f0f76867500953b82 -r 3419a45c1f01790b3108d1726253fcb46feedbf4 lib/galaxy/webapps/community/app.py
--- a/lib/galaxy/webapps/community/app.py
+++ b/lib/galaxy/webapps/community/app.py
@@ -49,5 +49,6 @@
# Let the HgwebConfigManager know where the hgweb.config file is located.
self.hgweb_config_manager = self.model.hgweb_config_manager
self.hgweb_config_manager.hgweb_config_dir = self.config.hgweb_config_dir
+ print >> sys.stderr, "Tool shed hgweb.config file is: ", self.hgweb_config_manager.hgweb_config
def shutdown( self ):
pass
diff -r 4471a94e8fbff8d8c165c58f0f76867500953b82 -r 3419a45c1f01790b3108d1726253fcb46feedbf4 lib/galaxy/webapps/community/util/hgweb_config.py
--- a/lib/galaxy/webapps/community/util/hgweb_config.py
+++ b/lib/galaxy/webapps/community/util/hgweb_config.py
@@ -4,6 +4,11 @@
log = logging.getLogger( __name__ )
+new_hgweb_config_template = """
+[paths]
+
+"""
+
class HgWebConfigManager( object ):
def __init__( self ):
self.hgweb_config_dir = None
@@ -41,7 +46,13 @@
def hgweb_config( self ):
hgweb_config = os.path.join( self.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 )
+ # We used to raise an exception here...
+ # raise Exception( "Required file %s does not exist - check config setting for hgweb_config_dir." % hgweb_config )
+ # ...but now we just log the missing file and create a new empty one.
+ log.debug( "Required file %s does not exist, so creating a new, empty file. Check your config setting for hgweb_config_dir." % hgweb_config )
+ hgweb_config_file = open( hgweb_config, 'wb' )
+ hgweb_config_file.write( new_hgweb_config_template )
+ hgweb_config_file.close()
return os.path.abspath( hgweb_config )
def make_backup( self ):
# Make a backup of the hgweb.config file.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Modules.py: Fix sa_session.add() for PJAs, remove unused imports, whitespace cleanup.
by Bitbucket 13 Nov '12
by Bitbucket 13 Nov '12
13 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/4471a94e8fbf/
changeset: 4471a94e8fbf
user: dannon
date: 2012-11-13 19:07:32
summary: Modules.py: Fix sa_session.add() for PJAs, remove unused imports, whitespace cleanup.
affected #: 1 file
diff -r 5013377e0bf7a656ea593098f1d1b38f3d6928c6 -r 4471a94e8fbff8d8c165c58f0f76867500953b82 lib/galaxy/workflow/modules.py
--- a/lib/galaxy/workflow/modules.py
+++ b/lib/galaxy/workflow/modules.py
@@ -3,7 +3,6 @@
from galaxy import web
from galaxy.tools.parameters import DataToolParameter, DummyDataset, RuntimeValue, check_param, visit_input_values
from galaxy.tools import DefaultToolState
-from galaxy.tools.parameters.grouping import Repeat, Conditional
from galaxy.util.bunch import Bunch
from galaxy.util.json import from_json_string, to_json_string
from galaxy.jobs.actions.post import ActionBox
@@ -13,12 +12,12 @@
log = logging.getLogger( __name__ )
class WorkflowModule( object ):
-
+
def __init__( self, trans ):
self.trans = trans
-
+
## ---- Creating modules from various representations ---------------------
-
+
@classmethod
def new( Class, trans, tool_id=None ):
"""
@@ -37,12 +36,12 @@
return Class( trans )
## ---- Saving in various forms ------------------------------------------
-
+
def save_to_step( self, step ):
step.type = self.type
-
+
## ---- General attributes -----------------------------------------------
-
+
def get_type( self ):
return self.type
def get_name( self ):
@@ -51,9 +50,9 @@
return None
def get_tooltip( self, static_path='' ):
return None
-
+
## ---- Configuration time -----------------------------------------------
-
+
def get_state( self ):
return None
def get_errors( self ):
@@ -66,16 +65,16 @@
pass
def get_config_form( self ):
raise TypeError( "Abstract method" )
-
+
def check_and_update_state( self ):
"""
If the state is not in sync with the current implementation of the
module, try to update. Returns a list of messages to be displayed
"""
pass
-
+
## ---- Run time ---------------------------------------------------------
-
+
def get_runtime_inputs( self ):
raise TypeError( "Abstract method" )
def get_runtime_state( self ):
@@ -86,7 +85,7 @@
raise TypeError( "Abstract method" )
def update_runtime_state( self, trans, state, values ):
raise TypeError( "Abstract method" )
-
+
def execute( self, trans, state ):
raise TypeError( "Abstract method" )
@@ -112,6 +111,7 @@
if step.tool_inputs and "name" in step.tool_inputs:
module.state['name'] = step.tool_inputs[ 'name' ]
return module
+
def save_to_step( self, step ):
step.type = self.type
step.tool_id = None
@@ -119,8 +119,10 @@
def get_data_inputs( self ):
return []
+
def get_data_outputs( self ):
return [ dict( name='output', extensions=['input'] ) ]
+
def get_config_form( self ):
form = web.FormBuilder( title=self.name ) \
.add_text( "name", "Name", value=self.state['name'] )
@@ -128,25 +130,29 @@
module=self, form=form )
def get_state( self, secure=True ):
return to_json_string( self.state )
-
+
def update_state( self, incoming ):
self.state['name'] = incoming.get( 'name', 'Input Dataset' )
-
+
def get_runtime_inputs( self, filter_set=['data'] ):
label = self.state.get( "name", "Input Dataset" )
return dict( input=DataToolParameter( None, Element( "param", name="input", label=label, multiple=True, type="data", format=', '.join(filter_set) ), self.trans ) )
+
def get_runtime_state( self ):
state = DefaultToolState()
state.inputs = dict( input=None )
return state
+
def encode_runtime_state( self, trans, state ):
fake_tool = Bunch( inputs = self.get_runtime_inputs() )
return state.encode( fake_tool, trans.app )
+
def decode_runtime_state( self, trans, string ):
fake_tool = Bunch( inputs = self.get_runtime_inputs() )
state = DefaultToolState()
state.decode( string, fake_tool, trans.app )
return state
+
def update_runtime_state( self, trans, state, values ):
errors = {}
for name, param in self.get_runtime_inputs().iteritems():
@@ -155,14 +161,14 @@
if error:
errors[ name ] = error
return errors
-
+
def execute( self, trans, state ):
return None, dict( output=state.inputs['input'])
-
+
class ToolModule( WorkflowModule ):
-
+
type = "tool"
-
+
def __init__( self, trans, tool_id ):
self.trans = trans
self.tool_id = tool_id
@@ -175,11 +181,13 @@
else:
self.errors = {}
self.errors[ tool_id ] = 'Tool unavailable'
+
@classmethod
def new( Class, trans, tool_id=None ):
module = Class( trans, tool_id )
module.state = module.tool.new_state( trans, all_pages=True )
return module
+
@classmethod
def from_dict( Class, trans, d, secure=True ):
tool_id = d[ 'tool_id' ]
@@ -191,6 +199,7 @@
module.post_job_actions = d.get( "post_job_actions", {} )
module.workflow_outputs = d.get( "workflow_outputs", [] )
return module
+
@classmethod
def from_workflow_step( Class, trans, step ):
tool_id = step.tool_id
@@ -215,12 +224,14 @@
module.post_job_actions = pjadict
return module
return None
+
@classmethod
def __get_tool_version( cls, trans, tool_id ):
# Return a ToolVersion if one exists for tool_id.
return trans.sa_session.query( trans.app.model.ToolVersion ) \
.filter( trans.app.model.ToolVersion.table.c.tool_id == tool_id ) \
.first()
+
def save_to_step( self, step ):
step.type = self.type
step.tool_id = self.tool_id
@@ -241,24 +252,31 @@
action_arguments = v['action_arguments']
else:
action_arguments = None
- n_p = PostJobAction(v['action_type'], step, output_name, action_arguments)
+ self.trans.sa_session.add(PostJobAction(v['action_type'], step, output_name, action_arguments))
+
def get_name( self ):
if self.tool:
return self.tool.name
return 'unavailable'
+
def get_tool_id( self ):
return self.tool_id
+
def get_tool_version( self ):
return self.tool.version
+
def get_state( self, secure=True ):
return self.state.encode( self.tool, self.trans.app, secure=secure )
+
def get_errors( self ):
return self.errors
+
def get_tooltip( self, static_path='' ):
if self.tool.help:
return self.tool.help.render( static_path=static_path )
else:
return None
+
def get_data_inputs( self ):
data_inputs = []
def callback( input, value, prefixed_name, prefixed_label ):
@@ -270,6 +288,7 @@
extensions=input.extensions ) )
visit_input_values( self.tool.inputs, self.state.inputs, callback )
return data_inputs
+
def get_data_outputs( self ):
data_outputs = []
data_inputs = None
@@ -293,20 +312,23 @@
formats.append( format )
data_outputs.append( dict( name=name, extensions=formats ) )
return data_outputs
+
def get_post_job_actions( self ):
return self.post_job_actions
+
def get_config_form( self ):
self.add_dummy_datasets()
- return self.trans.fill_template( "workflow/editor_tool_form.mako",
+ return self.trans.fill_template( "workflow/editor_tool_form.mako",
tool=self.tool, values=self.state.inputs, errors=( self.errors or {} ) )
- def update_state( self, incoming ):
+
+ def update_state( self, incoming ):
# Build a callback that handles setting an input to be required at
# runtime. We still process all other parameters the user might have
# set. We also need to make sure all datasets have a dummy value
# for dependencies to see
-
+
self.post_job_actions = ActionBox.handle_incoming(incoming)
-
+
make_runtime_key = incoming.get( 'make_runtime', None )
make_buildtime_key = incoming.get( 'make_buildtime', None )
def item_callback( trans, key, input, value, error, old_value, context ):
@@ -328,8 +350,10 @@
# Update state using incoming values
errors = self.tool.update_state( self.trans, self.tool.inputs, self.state.inputs, incoming, item_callback=item_callback )
self.errors = errors or None
+
def check_and_update_state( self ):
return self.tool.check_and_update_param_values( self.state.inputs, self.trans )
+
def add_dummy_datasets( self, connections=None):
if connections:
# Store onnections by input name
@@ -348,11 +372,12 @@
else:
replacement = DummyDataset()
return replacement
- visit_input_values( self.tool.inputs, self.state.inputs, callback )
+ visit_input_values( self.tool.inputs, self.state.inputs, callback )
class WorkflowModuleFactory( object ):
def __init__( self, module_types ):
self.module_types = module_types
+
def new( self, trans, type, tool_id=None ):
"""
Return module for type and (optional) tool_id intialized with
@@ -360,18 +385,20 @@
"""
assert type in self.module_types
return self.module_types[type].new( trans, tool_id )
+
def from_dict( self, trans, d, **kwargs ):
"""
Return module initialized from the data in dictionary `d`.
"""
type = d['type']
assert type in self.module_types
- return self.module_types[type].from_dict( trans, d, **kwargs )
+ return self.module_types[type].from_dict( trans, d, **kwargs )
+
def from_workflow_step( self, trans, step ):
"""
Return module initializd from the WorkflowStep object `step`.
"""
type = step.type
return self.module_types[type].from_workflow_step( trans, step )
-
+
module_factory = WorkflowModuleFactory( dict( data_input=InputDataModule, tool=ToolModule ) )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: dannon: Fix for rendering workflow tooltips when tool.help is nonexistent.
by Bitbucket 13 Nov '12
by Bitbucket 13 Nov '12
13 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/5013377e0bf7/
changeset: 5013377e0bf7
user: dannon
date: 2012-11-13 18:26:55
summary: Fix for rendering workflow tooltips when tool.help is nonexistent.
affected #: 1 file
diff -r d3ac39a6f8d7a5f95ffabb4ba8f8a846b17ac15a -r 5013377e0bf7a656ea593098f1d1b38f3d6928c6 lib/galaxy/workflow/modules.py
--- a/lib/galaxy/workflow/modules.py
+++ b/lib/galaxy/workflow/modules.py
@@ -255,7 +255,10 @@
def get_errors( self ):
return self.errors
def get_tooltip( self, static_path='' ):
- return self.tool.help.render( static_path=static_path )
+ if self.tool.help:
+ return self.tool.help.render( static_path=static_path )
+ else:
+ return None
def get_data_inputs( self ):
data_inputs = []
def callback( input, value, prefixed_name, prefixed_label ):
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Add a new HgWebConfigManager to manage the tool shed's hgweb.config file.
by Bitbucket 13 Nov '12
by Bitbucket 13 Nov '12
13 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/d3ac39a6f8d7/
changeset: d3ac39a6f8d7
user: greg
date: 2012-11-13 18:04:58
summary: Add a new HgWebConfigManager to manage the tool shed's hgweb.config file.
affected #: 8 files
diff -r 3024a86c0d0d21b1a85ff1b91516f34f416bcfcb -r d3ac39a6f8d7a5f95ffabb4ba8f8a846b17ac15a lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -118,6 +118,7 @@
self.workflows += 1
processed_relative_workflow_paths.append( relative_path )
self.generation_time = strftime( "%b %d, %Y", gmtime() )
+
def add_to_shed_tool_config( app, shed_tool_conf_dict, elem_list ):
# A tool shed repository is being installed so change the shed_tool_conf file. Parse the config file to generate the entire list
# of config_elems instead of using the in-memory list since it will be a subset of the entire list if one or more repositories have
@@ -1353,11 +1354,6 @@
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 ) )
diff -r 3024a86c0d0d21b1a85ff1b91516f34f416bcfcb -r d3ac39a6f8d7a5f95ffabb4ba8f8a846b17ac15a lib/galaxy/webapps/community/app.py
--- a/lib/galaxy/webapps/community/app.py
+++ b/lib/galaxy/webapps/community/app.py
@@ -46,5 +46,8 @@
# TODO: Add OpenID support
self.openid_providers = OpenIDProviders()
self.shed_counter = self.model.shed_counter
+ # Let the HgwebConfigManager know where the hgweb.config file is located.
+ self.hgweb_config_manager = self.model.hgweb_config_manager
+ self.hgweb_config_manager.hgweb_config_dir = self.config.hgweb_config_dir
def shutdown( self ):
pass
diff -r 3024a86c0d0d21b1a85ff1b91516f34f416bcfcb -r d3ac39a6f8d7a5f95ffabb4ba8f8a846b17ac15a 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,6 @@
import os, logging
from galaxy.web.base.controller import *
from galaxy.webapps.community.controllers.common import *
-from galaxy.util.shed_util import get_hgweb_config
from galaxy import eggs
eggs.require('mercurial')
@@ -18,9 +17,7 @@
# 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 ) )
+ hgweb_config = trans.app.hgweb_config_manager.hgweb_config
def make_web_app():
hgwebapp = hgwebdir( hgweb_config )
return hgwebapp
diff -r 3024a86c0d0d21b1a85ff1b91516f34f416bcfcb -r d3ac39a6f8d7a5f95ffabb4ba8f8a846b17ac15a lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -1,4 +1,4 @@
-import os, logging, tempfile, shutil
+import os, logging, tempfile, shutil, ConfigParser
from time import strftime
from datetime import date, datetime
from galaxy import util
@@ -11,7 +11,7 @@
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_hgweb_config
+from galaxy.util.shed_util import get_changectx_for_changeset, get_configured_ui, get_file_from_changeset_revision
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
@@ -530,26 +530,6 @@
repositories_i_own_grid = RepositoriesIOwnGrid()
deprecated_repositories_i_own_grid = DeprecatedRepositoriesIOwnGrid()
- 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 = 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 )
- tmp_fd, tmp_fname = tempfile.mkstemp()
- if os.path.exists( hgweb_config ):
- # Make a backup of the hgweb.config file since we're going to be changing it.
- self.__make_hgweb_config_copy( trans, hgweb_config )
- new_hgweb_config = open( tmp_fname, 'wb' )
- for i, line in enumerate( open( hgweb_config ) ):
- new_hgweb_config.write( line )
- else:
- new_hgweb_config = open( tmp_fname, 'wb' )
- new_hgweb_config.write( '[paths]\n' )
- new_hgweb_config.write( "%s\n" % entry )
- new_hgweb_config.flush()
- shutil.move( tmp_fname, os.path.abspath( hgweb_config ) )
@web.expose
def browse_categories( self, trans, **kwd ):
# The request came from the tool shed.
@@ -824,25 +804,14 @@
selected_value=selected_value,
refresh_on_change=False,
multiple=True )
- def __change_hgweb_config_entry( self, trans, repository, old_repository_name, new_repository_name ):
- # 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 = 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( 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()
- new_hgweb_config = open( tmp_fname, 'wb' )
- for i, line in enumerate( open( hgweb_config ) ):
- if line.startswith( old_lhs ):
- new_hgweb_config.write( new_entry )
- else:
- new_hgweb_config.write( line )
- new_hgweb_config.flush()
- shutil.move( tmp_fname, os.path.abspath( hgweb_config ) )
+ def __change_repository_name_in_hgrc_file( self, hgrc_file, new_name ):
+ config = ConfigParser.ConfigParser()
+ config.read( hgrc_file )
+ config.read( hgrc_file )
+ config.set( 'web', 'name', new_name )
+ new_file = open( hgrc_file, 'wb' )
+ config.write( new_file )
+ new_file.close()
@web.expose
def check_for_updates( self, trans, **kwd ):
"""Handle a request from a local Galaxy instance."""
@@ -1001,8 +970,9 @@
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, enabling calls to repository.repo_path( trans.app )
- self.__add_hgweb_config_entry( trans, repository, repository_path )
+ # Add an entry in the hgweb.config file for the local repository.
+ lhs = "repos/%s/%s" % ( repository.user.username, repository.name )
+ trans.app.hgweb_config_manager.add_entry( lhs, repository_path )
# Create a .hg/hgrc file for the local repository
self.__create_hgrc_file( trans, repository )
flush_needed = False
@@ -1616,13 +1586,6 @@
changeset_revision=changeset_revision,
message=message,
status='error' ) )
- def __make_hgweb_config_copy( self, trans, hgweb_config ):
- # Make a backup of the hgweb.config file
- today = date.today()
- backup_date = today.strftime( "%Y_%m_%d" )
- 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.
if len( list1 ) == 1:
@@ -1710,7 +1673,14 @@
if message:
error = True
else:
- self.__change_hgweb_config_entry( trans, repository, repository.name, repo_name )
+ # Change the entry in the hgweb.config file for the repository.
+ old_lhs = "repos/%s/%s" % ( repository.user.username, repository.name )
+ new_lhs = "repos/%s/%s" % ( repository.user.username, repo_name )
+ new_rhs = "%s\n" % repo_dir
+ trans.app.hgweb_config_manager.change_entry( old_lhs, new_lhs, new_rhs )
+ # Change the entry in the repository's hgrc file.
+ hgrc_file = os.path.join( repo_dir, '.hg', 'hgrc' )
+ self.__change_repository_name_in_hgrc_file( hgrc_file, repo_name )
repository.name = repo_name
flush_needed = True
elif repository.times_downloaded != 0 and repo_name != repository.name:
diff -r 3024a86c0d0d21b1a85ff1b91516f34f416bcfcb -r d3ac39a6f8d7a5f95ffabb4ba8f8a846b17ac15a lib/galaxy/webapps/community/model/__init__.py
--- a/lib/galaxy/webapps/community/model/__init__.py
+++ b/lib/galaxy/webapps/community/model/__init__.py
@@ -6,7 +6,6 @@
"""
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 *
@@ -110,12 +109,7 @@
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 ):
+ 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"
self.description = description
self.long_description = long_description
@@ -124,27 +118,8 @@
self.email_alerts = email_alerts
self.times_downloaded = times_downloaded
self.deprecated = deprecated
- 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 )
+ return app.hgweb_config_manager.get_entry( os.path.join( "repos", self.user.username, self.name ) )
def revision( self, app ):
repo = hg.repository( ui.ui(), self.repo_path( app ) )
tip_ctx = repo.changectx( repo.changelog.tip() )
diff -r 3024a86c0d0d21b1a85ff1b91516f34f416bcfcb -r d3ac39a6f8d7a5f95ffabb4ba8f8a846b17ac15a lib/galaxy/webapps/community/model/mapping.py
--- a/lib/galaxy/webapps/community/model/mapping.py
+++ b/lib/galaxy/webapps/community/model/mapping.py
@@ -14,6 +14,7 @@
from galaxy.model.custom_types import *
from galaxy.util.bunch import Bunch
from galaxy.util.shed_util import ShedCounter
+from galaxy.webapps.community.util.hgweb_config import *
from galaxy.webapps.community.security import CommunityRBACAgent
metadata = MetaData()
@@ -318,4 +319,5 @@
# Load local tool shed security policy
result.security_agent = CommunityRBACAgent( result )
result.shed_counter = ShedCounter( result )
+ result.hgweb_config_manager = HgWebConfigManager()
return result
diff -r 3024a86c0d0d21b1a85ff1b91516f34f416bcfcb -r d3ac39a6f8d7a5f95ffabb4ba8f8a846b17ac15a lib/galaxy/webapps/community/util/hgweb_config.py
--- /dev/null
+++ b/lib/galaxy/webapps/community/util/hgweb_config.py
@@ -0,0 +1,63 @@
+import sys, os, ConfigParser, logging, shutil
+from time import strftime
+from datetime import date
+
+log = logging.getLogger( __name__ )
+
+class HgWebConfigManager( object ):
+ def __init__( self ):
+ self.hgweb_config_dir = None
+ self.in_memory_config = None
+ def add_entry( self, lhs, rhs ):
+ """Add an entry in the hgweb.config file for a new repository."""
+ # Since we're changing the config, make sure the latest is loaded into memory.
+ self.read_config( force_read=True )
+ # An entry looks something like: repos/test/mira_assembler = database/community_files/000/repo_123.
+ if rhs.startswith( './' ):
+ rhs = rhs.replace( './', '', 1 )
+ self.make_backup()
+ # Add the new entry into memory.
+ self.in_memory_config.set( 'paths', lhs, rhs )
+ # Persist our in-memory configuration.
+ self.write_config()
+ def change_entry( self, old_lhs, new_lhs, new_rhs ):
+ """Change an entry in the hgweb.config file for a repository - this only happens when the owner changes the name of the repository."""
+ self.make_backup()
+ # Remove the old entry.
+ self.in_memory_config.remove_option( 'paths', old_lhs )
+ # Add the new entry.
+ self.in_memory_config.set( 'paths', new_lhs, new_rhs )
+ # Persist our in-memory configuration.
+ self.write_config()
+ def get_entry( self, lhs ):
+ """Return an entry in the hgweb.config file for a repository"""
+ self.read_config()
+ try:
+ entry = self.in_memory_config.get( 'paths', lhs )
+ except ConfigParser.NoOptionError:
+ raise Exception( "Entry for repository %s missing in file %s." % ( lhs, self.hgweb_config ) )
+ return entry
+ @property
+ def hgweb_config( self ):
+ hgweb_config = os.path.join( self.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 os.path.abspath( hgweb_config )
+ def make_backup( self ):
+ # Make a backup of the hgweb.config file.
+ today = date.today()
+ backup_date = today.strftime( "%Y_%m_%d" )
+ hgweb_config_backup_filename = 'hgweb.config_%s_backup' % backup_date
+ hgweb_config_copy = os.path.join( self.hgweb_config_dir, hgweb_config_backup_filename )
+ shutil.copy( os.path.abspath( self.hgweb_config ), os.path.abspath( hgweb_config_copy ) )
+ def read_config( self, force_read=False ):
+ if force_read or self.in_memory_config is None:
+ config = ConfigParser.ConfigParser()
+ config.read( self.hgweb_config )
+ self.in_memory_config = config
+ def write_config( self ):
+ """Writing the in-memory configuration to the hgweb.config file on disk."""
+ config_file = open( self.hgweb_config, 'wb' )
+ self.in_memory_config.write( config_file )
+ config_file.close
+
\ No newline at end of file
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Move the important details to the begining of the new tool shed repository alert email template, and include the repository name in the email subject.
by Bitbucket 12 Nov '12
by Bitbucket 12 Nov '12
12 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/3024a86c0d0d/
changeset: 3024a86c0d0d
user: greg
date: 2012-11-12 22:39:49
summary: Move the important details to the begining of the new tool shed repository alert email template, and include the repository name in the email subject.
affected #: 1 file
diff -r 74a7bc65f1ed8bde40425d1823ad8761b6cdcea8 -r 3024a86c0d0d21b1a85ff1b91516f34f416bcfcb lib/galaxy/webapps/community/controllers/common.py
--- a/lib/galaxy/webapps/community/controllers/common.py
+++ b/lib/galaxy/webapps/community/controllers/common.py
@@ -25,25 +25,23 @@
log = logging.getLogger( __name__ )
new_repo_email_alert_template = """
-GALAXY TOOL SHED NEW REPOSITORY ALERT
------------------------------------------------------------------------------
-You received this alert because you registered to receive email when
-new repositories were created in the Galaxy tool shed named "${host}".
------------------------------------------------------------------------------
+Revision: ${revision}
+Change description:
+${description}
Repository name: ${repository_name}
+Uploaded by: ${username}
Date content uploaded: ${display_date}
-Uploaded by: ${username}
-
-Revision: ${revision}
-Change description:
-${description}
${content_alert_str}
-----------------------------------------------------------------------------
This change alert was sent from the Galaxy tool shed hosted on the server
"${host}"
+-----------------------------------------------------------------------------
+You received this alert because you registered to receive email when
+new repositories were created in the Galaxy tool shed named "${host}".
+-----------------------------------------------------------------------------
"""
email_alert_template = """
@@ -497,7 +495,8 @@
admin_users = trans.app.config.get( "admin_users", "" ).split( "," )
frm = email_from
if new_repo_alert:
- subject = "New Galaxy tool shed repository alert"
+ subject = "Galaxy tool shed alert for new repository named %s" % str( repository.name )
+ subject = subject[ :80 ]
email_alerts = []
for user in trans.sa_session.query( trans.model.User ) \
.filter( and_( trans.model.User.table.c.deleted == False,
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Fix for viewing invalid tools in the tool shed.
by Bitbucket 12 Nov '12
by Bitbucket 12 Nov '12
12 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/74a7bc65f1ed/
changeset: 74a7bc65f1ed
user: greg
date: 2012-11-12 22:05:55
summary: Fix for viewing invalid tools in the tool shed.
affected #: 1 file
diff -r 8cc09edeafb2b01b034c8c4abff1b0bc95a66d47 -r 74a7bc65f1ed8bde40425d1823ad8761b6cdcea8 lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -1577,7 +1577,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'error' )
- repository_clone_url = generate_clone_url_for_repository_in_tool_shed( 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( trans.app ) )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Correct method name in the repository controller.
by Bitbucket 12 Nov '12
by Bitbucket 12 Nov '12
12 Nov '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/8cc09edeafb2/
changeset: 8cc09edeafb2
user: greg
date: 2012-11-12 22:00:31
summary: Correct method name in the repository controller.
affected #: 1 file
diff -r d60deede2b6a1d360bfd7479a68ab72eb162e84b -r 8cc09edeafb2b01b034c8c4abff1b0bc95a66d47 lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -1577,7 +1577,7 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'error' )
- repository_clone_url = generate_clone_url( trans, repository_id )
+ repository_clone_url = generate_clone_url_for_repository_in_tool_shed( 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( trans.app ) )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
commit/galaxy-central: greg: Make the directory containing the tool shed's hgweb.config file a setting in the tool shed config.
by Bitbucket 12 Nov '12
by Bitbucket 12 Nov '12
12 Nov '12
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.
1
0