Skip to content

Commit

Permalink
Use preexisting library to parse query string.
Browse files Browse the repository at this point in the history
  • Loading branch information
davebx committed Nov 13, 2015
1 parent 321b64d commit 87f35ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
13 changes: 0 additions & 13 deletions lib/galaxy/util/__init__.py
Expand Up @@ -335,19 +335,6 @@ def shrink_string_by_size( value, size, join_by="..", left_larger=True, beginnin
return value


def parse_query_string( query_string ):
if '=' not in query_string:
return {}
retval = {}
arguments = query_string.split( '&' )
for argument in arguments:
if '=' not in argument:
continue
key, value = argument.split( '=' )
retval[ key ] = value
return retval


def pretty_print_time_interval( time=False, precise=False ):
"""
Get a datetime object or a int() Epoch timestamp and return a
Expand Down
6 changes: 3 additions & 3 deletions lib/galaxy/webapps/tool_shed/framework/middleware/hg.py
Expand Up @@ -5,12 +5,12 @@
import sqlalchemy
import sys
import tempfile
import urlparse
from paste.auth.basic import AuthBasicAuthenticator
from paste.httpheaders import AUTH_TYPE
from paste.httpheaders import REMOTE_USER

from galaxy.util import asbool
from galaxy.util import parse_query_string
from galaxy.util.hash_util import new_secure_hash
from tool_shed.util import hg_util
from tool_shed.util import commit_util
Expand Down Expand Up @@ -50,11 +50,11 @@ def __call__( self, environ, start_response ):
# a clone or a pull. However, we do not want to increment the times_downloaded count if we're only setting repository
# metadata.
if cmd == 'getbundle' and not self.setting_repository_metadata:
hg_args = parse_query_string( environ[ 'HTTP_X_HGARG_1' ] )
hg_args = urlparse.parse_qs( environ[ 'HTTP_X_HGARG_1' ] )
# The 'common' parameter indicates the full sha-1 hash of the changeset the client currently has checked out. If
# this is 0000000000000000000000000000000000000000, then the client is performing a fresh checkout. If it has any
# other value, the client is getting updates to an existing checkout.
if 'common' in hg_args and hg_args[ 'common' ] == '0000000000000000000000000000000000000000':
if 'common' in hg_args and hg_args[ 'common' ][-1] == '0000000000000000000000000000000000000000':
# Increment the value of the times_downloaded column in the repository table for the cloned repository.
if 'PATH_INFO' in environ:
# Instantiate a database connection
Expand Down

0 comments on commit 87f35ea

Please sign in to comment.