def app_factory(global_conf, **kwargs):
 kwargs = load_app_properties(kwds=kwargs, config_prefix='TOOL_SHED_CONFIG_')
 if ('app' in kwargs):
  app = kwargs.pop('app')
 else:
  try:
   from galaxy.webapps.tool_shed.app import UniverseApplication
   app = UniverseApplication(global_conf=global_conf, **kwargs)
  except:
   import traceback
   import sys
   traceback.print_exc()
   sys.exit(1)
 atexit.register(app.shutdown)
 webapp = CommunityWebApplication(app, session_cookie='galaxycommunitysession', name='tool_shed')
 add_ui_controllers(webapp, app)
 webapp.add_route('/view/{owner}', controller='repository', action='sharable_owner')
 webapp.add_route('/view/{owner}/{name}', controller='repository', action='sharable_repository')
 webapp.add_route('/view/{owner}/{name}/{changeset_revision}', controller='repository', action='sharable_repository_revision')
 webapp.add_route('/repository/static/images/{repository_id}/{image_file:.+?}', controller='repository', action='display_image_in_repository', repository_id=None, image_file=None)
 webapp.add_route('/{controller}/{action}', action='index')
 webapp.add_route('/{action}', controller='repository', action='index')
 webapp.add_route('/repos/*path_info', controller='hg', action='handle_request', path_info='/')
 webapp.add_api_controllers('galaxy.webapps.tool_shed.api', app)
 webapp.mapper.connect('api_key_retrieval', '/api/authenticate/baseauth/', controller='authenticate', action='get_tool_shed_api_key', conditions=dict(method=['GET']))
 webapp.mapper.connect('group', '/api/groups/', controller='groups', action='index', conditions=dict(method=['GET']))
 webapp.mapper.connect('group', '/api/groups/', controller='groups', action='create', conditions=dict(method=['POST']))
 webapp.mapper.connect('group', '/api/groups/{encoded_id}', controller='groups', action='show', conditions=dict(method=['GET']))
 webapp.mapper.resource('category', 'categories', controller='categories', name_prefix='category_', path_prefix='/api', parent_resources=dict(member_name='category', collection_name='categories'))
 webapp.mapper.connect('repositories_in_category', '/api/categories/{category_id}/repositories', controller='categories', action='get_repositories', conditions=dict(method=['GET']))
 webapp.mapper.connect('show_updates_for_repository', '/api/repositories/updates', controller='repositories', action='updates', conditions=dict(method=['GET']))
 webapp.mapper.resource('repository', 'repositories', controller='repositories', collection={'add_repository_registry_entry': 'POST', 'get_repository_revision_install_info': 'GET', 'get_ordered_installable_revisions': 'GET', 'get_installable_revisions': 'GET', 'remove_repository_registry_entry': 'POST', 'repository_ids_for_setting_metadata': 'GET', 'reset_metadata_on_repositories': 'POST', 'reset_metadata_on_repository': 'POST'}, name_prefix='repository_', path_prefix='/api', new={'import_capsule': 'POST'}, parent_resources=dict(member_name='repository', collection_name='repositories'))
 webapp.mapper.resource('repository_revision', 'repository_revisions', member={'repository_dependencies': 'GET', 'export': 'POST'}, controller='repository_revisions', name_prefix='repository_revision_', path_prefix='/api', parent_resources=dict(member_name='repository_revision', collection_name='repository_revisions'))
 webapp.mapper.resource('user', 'users', controller='users', name_prefix='user_', path_prefix='/api', parent_resources=dict(member_name='user', collection_name='users'))
 webapp.mapper.connect('update_repository', '/api/repositories/{id}', controller='repositories', action='update', conditions=dict(method=['PATCH', 'PUT']))
 webapp.mapper.connect('repository_create_changeset_revision', '/api/repositories/{id}/changeset_revision', controller='repositories', action='create_changeset_revision', conditions=dict(method=['POST']))
 webapp.mapper.connect('repository_get_metadata', '/api/repositories/{id}/metadata', controller='repositories', action='metadata', conditions=dict(method=['GET']))
 webapp.mapper.connect('repository_show_tools', '/api/repositories/{id}/{changeset}/show_tools', controller='repositories', action='show_tools', conditions=dict(method=['GET']))
 webapp.mapper.connect('create_repository', '/api/repositories', controller='repositories', action='create', conditions=dict(method=['POST']))
 webapp.mapper.connect('tools', '/api/tools', controller='tools', action='index', conditions=dict(method=['GET']))
 webapp.mapper.connect('version', '/api/version', controller='configuration', action='version', conditions=dict(method=['GET']))
 webapp.finalize_config()
 if kwargs.get('middleware', True):
  webapp = wrap_in_middleware(webapp, global_conf, **kwargs)
 if asbool(kwargs.get('static_enabled', True)):
  if process_is_uwsgi:
   log.error('Static middleware is enabled in your configuration but this is a uwsgi process.  Refusing to wrap in static middleware.')
  else:
   webapp = wrap_in_static(webapp, global_conf, **kwargs)
 try:
  galaxy.webapps.tool_shed.model.mapping.metadata.bind.dispose()
 except:
  log.exception('Unable to dispose of pooled tool_shed model database connections.')
 return webapp

def app_factory ( global_conf , ** kwargs ) : kwargs = load_app_properties ( kwds = kwargs , config_prefix = 'TOOL_SHED_CONFIG_' ) if ( 'app' in kwargs ) : app = kwargs . pop ( 'app' ) else : try : from galaxy . webapps . tool_shed . app import UniverseApplication app = UniverseApplication ( global_conf = global_conf , ** kwargs ) except : import traceback import sys traceback . print_exc ( ) sys . exit ( 1 ) atexit . register ( app . shutdown ) webapp = CommunityWebApplication ( app , session_cookie = 'galaxycommunitysession' , name = 'tool_shed' ) add_ui_controllers ( webapp , app ) webapp . add_route ( '/view/{owner}' , controller = 'repository' , action = 'sharable_owner' ) webapp . add_route ( '/view/{owner}/{name}' , controller = 'repository' , action = 'sharable_repository' ) webapp . add_route ( '/view/{owner}/{name}/{changeset_revision}' , controller = 'repository' , action = 'sharable_repository_revision' ) webapp . add_route ( '/repository/static/images/{repository_id}/{image_file:.+?}' , controller = 'repository' , action = 'display_image_in_repository' , repository_id = None , image_file = None ) webapp . add_route ( '/{controller}/{action}' , action = 'index' ) webapp . add_route ( '/{action}' , controller = 'repository' , action = 'index' ) webapp . add_route ( '/repos/*path_info' , controller = 'hg' , action = 'handle_request' , path_info = '/' ) webapp . add_api_controllers ( 'galaxy.webapps.tool_shed.api' , app ) webapp . mapper . connect ( 'api_key_retrieval' , '/api/authenticate/baseauth/' , controller = 'authenticate' , action = 'get_tool_shed_api_key' , conditions = dict ( method = [ 'GET' ] ) ) webapp . mapper . connect ( 'group' , '/api/groups/' , controller = 'groups' , action = 'index' , conditions = dict ( method = [ 'GET' ] ) ) webapp . mapper . connect ( 'group' , '/api/groups/' , controller = 'groups' , action = 'create' , conditions = dict ( method = [ 'POST' ] ) ) webapp . mapper . connect ( 'group' , '/api/groups/{encoded_id}' , controller = 'groups' , action = 'show' , conditions = dict ( method = [ 'GET' ] ) ) webapp . mapper . resource ( 'category' , 'categories' , controller = 'categories' , name_prefix = 'category_' , path_prefix = '/api' , parent_resources = dict ( member_name = 'category' , collection_name = 'categories' ) ) webapp . mapper . connect ( 'repositories_in_category' , '/api/categories/{category_id}/repositories' , controller = 'categories' , action = 'get_repositories' , conditions = dict ( method = [ 'GET' ] ) ) webapp . mapper . connect ( 'show_updates_for_repository' , '/api/repositories/updates' , controller = 'repositories' , action = 'updates' , conditions = dict ( method = [ 'GET' ] ) ) webapp . mapper . resource ( 'repository' , 'repositories' , controller = 'repositories' , collection = { 'add_repository_registry_entry' : 'POST' , 'get_repository_revision_install_info' : 'GET' , 'get_ordered_installable_revisions' : 'GET' , 'get_installable_revisions' : 'GET' , 'remove_repository_registry_entry' : 'POST' , 'repository_ids_for_setting_metadata' : 'GET' , 'reset_metadata_on_repositories' : 'POST' , 'reset_metadata_on_repository' : 'POST' } , name_prefix = 'repository_' , path_prefix = '/api' , new = { 'import_capsule' : 'POST' } , parent_resources = dict ( member_name = 'repository' , collection_name = 'repositories' ) ) webapp . mapper . resource ( 'repository_revision' , 'repository_revisions' , member = { 'repository_dependencies' : 'GET' , 'export' : 'POST' } , controller = 'repository_revisions' , name_prefix = 'repository_revision_' , path_prefix = '/api' , parent_resources = dict ( member_name = 'repository_revision' , collection_name = 'repository_revisions' ) ) webapp . mapper . resource ( 'user' , 'users' , controller = 'users' , name_prefix = 'user_' , path_prefix = '/api' , parent_resources = dict ( member_name = 'user' , collection_name = 'users' ) ) webapp . mapper . connect ( 'update_repository' , '/api/repositories/{id}' , controller = 'repositories' , action = 'update' , conditions = dict ( method = [ 'PATCH' , 'PUT' ] ) ) webapp . mapper . connect ( 'repository_create_changeset_revision' , '/api/repositories/{id}/changeset_revision' , controller = 'repositories' , action = 'create_changeset_revision' , conditions = dict ( method = [ 'POST' ] ) ) webapp . mapper . connect ( 'repository_get_metadata' , '/api/repositories/{id}/metadata' , controller = 'repositories' , action = 'metadata' , conditions = dict ( method = [ 'GET' ] ) ) webapp . mapper . connect ( 'repository_show_tools' , '/api/repositories/{id}/{changeset}/show_tools' , controller = 'repositories' , action = 'show_tools' , conditions = dict ( method = [ 'GET' ] ) ) webapp . mapper . connect ( 'create_repository' , '/api/repositories' , controller = 'repositories' , action = 'create' , conditions = dict ( method = [ 'POST' ] ) ) webapp . mapper . connect ( 'tools' , '/api/tools' , controller = 'tools' , action = 'index' , conditions = dict ( method = [ 'GET' ] ) ) webapp . mapper . connect ( 'version' , '/api/version' , controller = 'configuration' , action = 'version' , conditions = dict ( method = [ 'GET' ] ) ) webapp . finalize_config ( ) if kwargs . get ( 'middleware' , True ) : webapp = wrap_in_middleware ( webapp , global_conf , ** kwargs ) if asbool ( kwargs . get ( 'static_enabled' , True ) ) : if process_is_uwsgi : log . error ( 'Static middleware is enabled in your configuration but this is a uwsgi process.  Refusing to wrap in static middleware.' ) else : webapp = wrap_in_static ( webapp , global_conf , ** kwargs ) try : galaxy . webapps . tool_shed . model . mapping . metadata . bind . dispose ( ) except : log . exception ( 'Unable to dispose of pooled tool_shed model database connections.' ) return webapp
return a wsgi application serving the root object .