Show More
@@ -2,6 +2,8 b' import os' | |||
|
2 | 2 | from mercurial.hgweb import hgweb |
|
3 | 3 | from mercurial.hgweb.request import wsgiapplication |
|
4 | 4 | from pylons_app.lib.utils import make_ui |
|
5 | from pylons.controllers.util import abort | |
|
6 | from webob.exc import HTTPNotFound | |
|
5 | 7 | class SimpleHg(object): |
|
6 | 8 | |
|
7 | 9 | def __init__(self, application, config): |
@@ -12,16 +14,20 b' class SimpleHg(object):' | |||
|
12 | 14 | if not is_mercurial(environ): |
|
13 | 15 | return self.application(environ, start_response) |
|
14 | 16 | else: |
|
15 | #repo_name = environ['PATH_INFO'].replace('/', '') | |
|
17 | try: | |
|
16 | 18 | repo_name = environ['PATH_INFO'].split('/')[1] |
|
17 | if not environ['PATH_INFO'].endswith == '/': | |
|
18 | environ['PATH_INFO'] += '/' | |
|
19 | #environ['SCRIPT_NAME'] = request.path | |
|
19 | except: | |
|
20 | return HTTPNotFound()(environ, start_response) | |
|
21 | ||
|
22 | #since we wrap into hgweb, just reset the path | |
|
20 | 23 | environ['PATH_INFO'] = '/' |
|
21 | 24 | self.baseui = make_ui() |
|
22 | 25 | self.basepath = self.baseui.configitems('paths')[0][1].replace('*', '') |
|
23 | 26 | self.repo_path = os.path.join(self.basepath, repo_name) |
|
27 | try: | |
|
24 | 28 | app = wsgiapplication(self._make_app) |
|
29 | except Exception as e: | |
|
30 | return HTTPNotFound()(environ, start_response) | |
|
25 | 31 | return app(environ, start_response) |
|
26 | 32 | |
|
27 | 33 | def _make_app(self): |
General Comments 0
You need to be logged in to leave comments.
Login now