Mercurial > public > src > rhodecode
changeset 96:f24b9a2934cf
added is mercurial method in utils,
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 24 Apr 2010 18:20:59 +0200 |
parents | a214462101d2 |
children | be0096a02772 |
files | pylons_app/lib/auth.py pylons_app/lib/utils.py |
diffstat | 2 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/pylons_app/lib/auth.py Sat Apr 24 17:15:57 2010 +0200 +++ b/pylons_app/lib/auth.py Sat Apr 24 18:20:59 2010 +0200 @@ -36,7 +36,6 @@ 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:
--- a/pylons_app/lib/utils.py Sat Apr 24 17:15:57 2010 +0200 +++ b/pylons_app/lib/utils.py Sat Apr 24 18:20:59 2010 +0200 @@ -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