##// END OF EJS Templates
simplehg update
marcink -
r178:24dbf4bc default
parent child Browse files
Show More
@@ -1,8 +1,21 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3 #
4 # Copyright (c) 2010 marcink. All rights reserved.
5 #
6 """
7 Created on 2010-04-28
8
9 @author: marcink
10 SimpleHG middleware for handling mercurial protocol request (push/clone etc.)
11 It's implemented with basic auth function
12 """
13
1 from mercurial.hgweb import hgweb
14 from mercurial.hgweb import hgweb
2 from mercurial.hgweb.request import wsgiapplication
15 from mercurial.hgweb.request import wsgiapplication
3 from paste.auth.basic import AuthBasicAuthenticator
16 from paste.auth.basic import AuthBasicAuthenticator
4 from paste.httpheaders import REMOTE_USER, AUTH_TYPE
17 from paste.httpheaders import REMOTE_USER, AUTH_TYPE
5 from pylons.controllers.util import abort
18 from pylons_app.lib.utils import is_mercurial
6 from pylons_app.lib.auth import authfunc
19 from pylons_app.lib.auth import authfunc
7 from pylons_app.lib.utils import make_ui, invalidate_cache
20 from pylons_app.lib.utils import make_ui, invalidate_cache
8 from webob.exc import HTTPNotFound
21 from webob.exc import HTTPNotFound
@@ -71,15 +84,3 b' class SimpleHg(object):'
71 return hgserve
84 return hgserve
72
85
73
86
74
75 def is_mercurial(environ):
76 """
77 Returns True if request's target is mercurial server - header
78 ``HTTP_ACCEPT`` of such request would start with ``application/mercurial``.
79 """
80 http_accept = environ.get('HTTP_ACCEPT')
81 if http_accept and http_accept.startswith('application/mercurial'):
82 return True
83 return False
84
85
General Comments 0
You need to be logged in to leave comments. Login now