Skip to content

Commit

Permalink
reimplement clone tracking that used to be in the middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
martenson committed Aug 12, 2016
1 parent 0f5239d commit 25d9e09
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/galaxy/webapps/tool_shed/controllers/hg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from galaxy import web
from galaxy.web.base.controller import BaseUIController
from tool_shed.util.repository_util import get_repository_by_name_and_owner

log = logging.getLogger(__name__)

Expand All @@ -15,9 +16,21 @@ def handle_request( self, trans, **kwd ):
# 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
hgweb_config = trans.app.hgweb_config_manager.hgweb_config
cmd = kwd.get( 'cmd', None )

def make_web_app():
hgwebapp = hgwebdir( hgweb_config )
return hgwebapp
wsgi_app = wsgiapplication( make_web_app )
if cmd == 'getbundle':
path_info = kwd.get( 'path_info', None )
if path_info:
owner, name = path_info.split( '/' )
repository = get_repository_by_name_and_owner( trans.app, name, owner )
if repository:
times_downloaded = repository.times_downloaded
times_downloaded += 1
repository.times_downloaded = times_downloaded
trans.sa_session.add( repository )
trans.sa_session.flush()
return wsgi_app

0 comments on commit 25d9e09

Please sign in to comment.