Show More
@@ -21,12 +21,10 b' class HgController(BaseController):' | |||||
21 |
|
21 | |||
22 | def __before__(self): |
|
22 | def __before__(self): | |
23 | c.repos_prefix = config['repos_name'] |
|
23 | c.repos_prefix = config['repos_name'] | |
24 |
|
||||
25 | c.repo_name = get_repo_slug(request) |
|
24 | c.repo_name = get_repo_slug(request) | |
26 |
|
25 | |||
27 | def index(self): |
|
26 | def index(self): | |
28 |
|
27 | |||
29 |
|
||||
30 | hg_model = HgModel() |
|
28 | hg_model = HgModel() | |
31 | @cache_region('short_term', 'repo_list') |
|
29 | @cache_region('short_term', 'repo_list') | |
32 | def _list(): |
|
30 | def _list(): | |
@@ -47,38 +45,3 b' class HgController(BaseController):' | |||||
47 | c.repos_list.sort(key=itemgetter(sort_key), reverse=False) |
|
45 | c.repos_list.sort(key=itemgetter(sort_key), reverse=False) | |
48 |
|
46 | |||
49 | return render('/index.html') |
|
47 | return render('/index.html') | |
50 |
|
||||
51 | def view(self, environ, start_response, path_info): |
|
|||
52 | print path_info |
|
|||
53 |
|
||||
54 | def app_maker(): |
|
|||
55 |
|
||||
56 | path = os.path.join(g.base_path, c.repo_name) |
|
|||
57 | repo = repository(g.baseui, path) |
|
|||
58 | hgwebapp = hgweb(repo, c.repo_name) |
|
|||
59 | return hgwebapp |
|
|||
60 |
|
||||
61 | a = wsgiapplication(app_maker) |
|
|||
62 | resp = a(environ, start_response) |
|
|||
63 |
|
||||
64 | http_accept = request.environ.get('HTTP_ACCEPT', False) |
|
|||
65 | if not http_accept: |
|
|||
66 | return abort(status_code=400, detail='no http accept in header') |
|
|||
67 |
|
||||
68 | #for mercurial protocols and raw files we can't wrap into mako |
|
|||
69 | if http_accept.find("mercurial") != -1 or \ |
|
|||
70 | request.environ['PATH_INFO'].find('raw-file') != -1: |
|
|||
71 | return resp |
|
|||
72 | try: |
|
|||
73 | tmpl = u''.join(resp) |
|
|||
74 | template = Template(tmpl, lookup=request.environ['pylons.pylons']\ |
|
|||
75 | .config['pylons.app_globals'].mako_lookup) |
|
|||
76 |
|
||||
77 | except (RuntimeError, UnicodeDecodeError): |
|
|||
78 | log.info('disabling unicode due to encoding error') |
|
|||
79 | resp = g.hgapp(request.environ, self.start_response) |
|
|||
80 | tmpl = ''.join(resp) |
|
|||
81 | template = Template(tmpl, lookup=request.environ['pylons.pylons']\ |
|
|||
82 | .config['pylons.app_globals'].mako_lookup, disable_unicode=True) |
|
|||
83 |
|
||||
84 | return template.render(g=g, c=c, session=session, h=h) |
|
General Comments 0
You need to be logged in to leave comments.
Login now