Mercurial > public > src > rhodecode
changeset 31:2963f2894a7a
Tempalting change, bugfix for serving raw files, and diffs. Now raw files are not parsed thruough mako, and diffs are mako safe (not parsed also)
line wrap: on
line diff
--- a/pylons_app/config/middleware.py Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/config/middleware.py Thu Mar 04 23:13:12 2010 +0100 @@ -12,7 +12,7 @@ from pylons_app.config.environment import load_environment -def make_app(global_conf, full_stack = True, **app_conf): +def make_app(global_conf, full_stack=True, **app_conf): """Create a Pylons WSGI application and return it ``global_conf``
--- a/pylons_app/controllers/hg.py Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/controllers/hg.py Thu Mar 04 23:13:12 2010 +0100 @@ -10,7 +10,7 @@ from mercurial import ui, hg from mercurial.error import RepoError from ConfigParser import ConfigParser - +import encodings log = logging.getLogger(__name__) class HgController(BaseController): @@ -18,24 +18,28 @@ def __before__(self): c.repos_prefix = 'etelko' - def view(self, *args, **kwargs): response = g.hgapp(request.environ, self.start_response) - #for mercurial protocols we can't wrap into mako - if request.environ['HTTP_ACCEPT'].find("mercurial") >= 0: + #for mercurial protocols and raw files we can't wrap into mako + if request.environ['HTTP_ACCEPT'].find("mercurial") != -1 or \ + request.environ['PATH_INFO'].find('raw-file') != -1: return response - #wrap the murcurial response in a mako template. - template = Template("".join(response), - lookup = request.environ['pylons.pylons']\ + tmpl = ''.join(response) + + template = Template(tmpl, lookup=request.environ['pylons.pylons']\ .config['pylons.g'].mako_lookup) - return template.render(g = g, c = c, session = session, h = h) + return template.render(g=g, c=c, session=session, h=h) def manage_hgrc(self): pass + def hgrc(self, dirname): + filename = os.path.join(dirname, '.hg', 'hgrc') + return filename + def add_repo(self, new_repo): c.staticurl = g.statics
--- a/pylons_app/lib/app_globals.py Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/lib/app_globals.py Thu Mar 04 23:13:12 2010 +0100 @@ -38,7 +38,16 @@ baseui.setconfig('web', k, v) #magic trick to make our custom template dir working templater.path.append(cfg.get('web', 'templates', None)) - hgwebapp = hgwebdir(paths, baseui = baseui) + + #baseui.setconfig('web', 'description', '') + #baseui.setconfig('web', 'name', '') + #baseui.setconfig('web', 'contact', '') + #baseui.setconfig('web', 'allow_archive', '') + #baseui.setconfig('web', 'style', 'monoblue_plain') + #baseui.setconfig('web', 'baseurl', '') + #baseui.setconfig('web', 'staticurl', '') + + hgwebapp = hgwebdir(paths, baseui=baseui) return hgwebapp
--- a/pylons_app/templates/monoblue_custom/branches.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/branches.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Branches</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/changelog.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/changelog.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: changelog</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/changelogentry.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/changelogentry.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- <h3 class="changelog"><a class="title" href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape|nonempty}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a></h3> <ul class="changelog-entry"> <li class="age">{date|age}</li>
--- a/pylons_app/templates/monoblue_custom/changeset.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/changeset.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: changeset {rev}:{node|short}</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/> @@ -57,7 +58,9 @@ </table> <div class="diff"> - {diff} + <%text filter="n"> + {diff} + </%text> </div> {footer}
--- a/pylons_app/templates/monoblue_custom/error.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/error.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Error</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/fileannotate.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/fileannotate.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: {file|escape}@{node|short} (annotated)</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/filediff.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/filediff.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: diff {file|escape}</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/> @@ -48,7 +49,9 @@ </dl> <div class="diff"> - {diff} + <%text filter="n"> + {diff} + </%text> </div> {footer}
--- a/pylons_app/templates/monoblue_custom/filelog.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/filelog.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: File revisions</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/filerevision.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/filerevision.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: {file|escape}@{node|short}</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/> @@ -57,7 +58,9 @@ <p class="description">{desc|strip|escape|addbreaks|nonempty}</p> <div class="source"> - {text%fileline} + <%text filter="n"> + {text%fileline} + </%text> </div> {footer}
--- a/pylons_app/templates/monoblue_custom/footer.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/footer.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- <div class="page-footer"> <p>Mercurial Repository: {repo|escape}</p> <ul class="rss-logo">
--- a/pylons_app/templates/monoblue_custom/graph.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/graph.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: graph</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/header.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/header.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>
--- a/pylons_app/templates/monoblue_custom/index.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/index.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Mercurial repositories index</title> </head>
--- a/pylons_app/templates/monoblue_custom/manifest.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/manifest.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: files</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/notfound.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/notfound.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Mercurial repository not found</title> </head>
--- a/pylons_app/templates/monoblue_custom/search.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/search.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Search</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/shortlog.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/shortlog.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: shortlog</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/summary.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/summary.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Summary</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_custom/tags.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/tags.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Tags</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_plain/changelog.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/changelog.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <div id="container"> <div class="page-header">
--- a/pylons_app/templates/monoblue_plain/changelogentry.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/changelogentry.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- <h3 class="changelog"><a class="title" href="{url}rev/{node|short}{sessionvars%urlparameter}">{desc|strip|firstline|escape}<span class="logtags"> {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></a></h3> <h4>{date|age} ago, by {author|obfuscate} [{date|rfc822date}] rev {rev}</h4> <p>{desc|strip|escape|addbreaks}</p>
--- a/pylons_app/templates/monoblue_plain/changeset.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/changeset.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <div id="container"> <div class="page-header">
--- a/pylons_app/templates/monoblue_plain/error.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/error.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Error</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_plain/fileannotate.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/fileannotate.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <div id="container"> <div class="page-header">
--- a/pylons_app/templates/monoblue_plain/filediff.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/filediff.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <div id="container"> <div class="page-header">
--- a/pylons_app/templates/monoblue_plain/filelog.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/filelog.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <div id="container"> <div class="page-header">
--- a/pylons_app/templates/monoblue_plain/filerevision.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/filerevision.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <div id="container"> <div class="page-header">
--- a/pylons_app/templates/monoblue_plain/footer.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/footer.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- <div class="page-footer"> <p> Mercurial Repository: {repo|escape}
--- a/pylons_app/templates/monoblue_plain/graph.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/graph.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <!--[if IE]><script type="text/javascript" src="{staticurl}excanvas.js"></script><![endif]--> <div id="container">
--- a/pylons_app/templates/monoblue_plain/header.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/header.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,1 +1,1 @@ - +## -*- coding: utf-8 -*-
--- a/pylons_app/templates/monoblue_plain/index.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/index.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <div id="container"> <div class="page-header">
--- a/pylons_app/templates/monoblue_plain/manifest.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/manifest.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <div id="container"> <div class="page-header">
--- a/pylons_app/templates/monoblue_plain/notfound.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/notfound.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Mercurial repository not found</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_plain/search.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/search.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <title>{repo|escape}: Search</title> <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
--- a/pylons_app/templates/monoblue_plain/shortlog.tmpl Thu Mar 04 23:08:57 2010 +0100 +++ b/pylons_app/templates/monoblue_plain/shortlog.tmpl Thu Mar 04 23:13:12 2010 +0100 @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} <div id="container"> <div class="page-header">