Mercurial > public > src > rhodecode
diff pylons_app/lib/simplehg.py @ 178:24dbf4bc57aa
simplehg update
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 21 May 2010 20:58:18 +0200 |
parents | 93bd77e1f3c1 |
children | 3380ca40cdba |
line wrap: on
line diff
--- a/pylons_app/lib/simplehg.py Fri May 21 20:50:03 2010 +0200 +++ b/pylons_app/lib/simplehg.py Fri May 21 20:58:18 2010 +0200 @@ -1,8 +1,21 @@ +#!/usr/bin/env python +# encoding: utf-8 +# +# Copyright (c) 2010 marcink. All rights reserved. +# +""" +Created on 2010-04-28 + +@author: marcink +SimpleHG middleware for handling mercurial protocol request (push/clone etc.) +It's implemented with basic auth function +""" + from mercurial.hgweb import hgweb from mercurial.hgweb.request import wsgiapplication from paste.auth.basic import AuthBasicAuthenticator from paste.httpheaders import REMOTE_USER, AUTH_TYPE -from pylons.controllers.util import abort +from pylons_app.lib.utils import is_mercurial from pylons_app.lib.auth import authfunc from pylons_app.lib.utils import make_ui, invalidate_cache from webob.exc import HTTPNotFound @@ -71,15 +84,3 @@ return hgserve - -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 - -