Mercurial > public > src > rhodecode
comparison pylons_app/controllers/hg.py @ 32:f93b523c0be3
dirty fix for multiple file encodings,
author | Marcin Kuzminski <marcin@python-blog.com> |
---|---|
date | Fri, 05 Mar 2010 01:14:30 +0100 |
parents | 2963f2894a7a |
children | 707dfdb1c7a8 |
comparison
equal
deleted
inserted
replaced
31:2963f2894a7a | 32:f93b523c0be3 |
---|---|
22 response = g.hgapp(request.environ, self.start_response) | 22 response = g.hgapp(request.environ, self.start_response) |
23 #for mercurial protocols and raw files we can't wrap into mako | 23 #for mercurial protocols and raw files we can't wrap into mako |
24 if request.environ['HTTP_ACCEPT'].find("mercurial") != -1 or \ | 24 if request.environ['HTTP_ACCEPT'].find("mercurial") != -1 or \ |
25 request.environ['PATH_INFO'].find('raw-file') != -1: | 25 request.environ['PATH_INFO'].find('raw-file') != -1: |
26 return response | 26 return response |
27 try: | |
28 tmpl = u''.join(response) | |
29 template = Template(tmpl, lookup=request.environ['pylons.pylons']\ | |
30 .config['pylons.g'].mako_lookup) | |
31 | |
32 except (RuntimeError, UnicodeDecodeError): | |
33 log.info('disabling unicode due to encoding error') | |
34 response = g.hgapp(request.environ, self.start_response) | |
35 tmpl = ''.join(response) | |
36 template = Template(tmpl, lookup=request.environ['pylons.pylons']\ | |
37 .config['pylons.g'].mako_lookup, disable_unicode=True) | |
27 | 38 |
28 tmpl = ''.join(response) | |
29 | |
30 template = Template(tmpl, lookup=request.environ['pylons.pylons']\ | |
31 .config['pylons.g'].mako_lookup) | |
32 | 39 |
33 return template.render(g=g, c=c, session=session, h=h) | 40 return template.render(g=g, c=c, session=session, h=h) |
34 | 41 |
35 | 42 |
36 def manage_hgrc(self): | 43 def manage_hgrc(self): |