# HG changeset patch # User Marcin Kuzminski # Date 2010-04-24 16:20:59 # Node ID f24b9a2934cfbddd2dd3eb38045be63a54af6bf8 # Parent a214462101d2c1b95c8b7eda421f9dc93843bd7b added is mercurial method in utils, diff --git a/pylons_app/lib/auth.py b/pylons_app/lib/auth.py --- a/pylons_app/lib/auth.py +++ b/pylons_app/lib/auth.py @@ -36,7 +36,6 @@ def admin_auth(username, password): def authfunc(environ, username, password): sa = meta.Session password_crypt = get_crypt_password(password) - try: user = sa.query(Users).filter(Users.username == username).one() except (NoResultFound, MultipleResultsFound, OperationalError) as e: diff --git a/pylons_app/lib/utils.py b/pylons_app/lib/utils.py --- a/pylons_app/lib/utils.py +++ b/pylons_app/lib/utils.py @@ -1,8 +1,16 @@ def get_repo_slug(request): path_info = request.environ.get('PATH_INFO') - uri_lst = path_info.split('/') - print uri_lst - print 'len', len(uri_lst) + uri_lst = path_info.split('/') repo_name = uri_lst[1] return repo_name + +def is_mercurial(environ): + """ + Returns True if request's target is mercurial server - header + ``HTTP_ACCEPT`` of such request would start with ``application/mercurial``. + """ + http_accept = environ.get('HTTP_ACCEPT') + if http_accept and http_accept.startswith('application/mercurial'): + return True + return False