# HG changeset patch # User Marcin Kuzminski # Date 2010-03-04 23:13:12 # Node ID 2963f2894a7a2fe126336b2cb64dca9ff2ca86fb # Parent 424167fefd6c4b4d8d264ab74492a81f5c1fb844 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) diff --git a/pylons_app/config/middleware.py b/pylons_app/config/middleware.py --- a/pylons_app/config/middleware.py +++ b/pylons_app/config/middleware.py @@ -12,7 +12,7 @@ from routes.middleware import RoutesMidd 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`` diff --git a/pylons_app/controllers/hg.py b/pylons_app/controllers/hg.py --- a/pylons_app/controllers/hg.py +++ b/pylons_app/controllers/hg.py @@ -10,7 +10,7 @@ import os 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 @@ class HgController(BaseController): 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 diff --git a/pylons_app/lib/app_globals.py b/pylons_app/lib/app_globals.py --- a/pylons_app/lib/app_globals.py +++ b/pylons_app/lib/app_globals.py @@ -38,7 +38,16 @@ class Globals(object): 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 diff --git a/pylons_app/templates/monoblue_custom/branches.tmpl b/pylons_app/templates/monoblue_custom/branches.tmpl --- a/pylons_app/templates/monoblue_custom/branches.tmpl +++ b/pylons_app/templates/monoblue_custom/branches.tmpl @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} {repo|escape}: Branches diff --git a/pylons_app/templates/monoblue_custom/changelog.tmpl b/pylons_app/templates/monoblue_custom/changelog.tmpl --- a/pylons_app/templates/monoblue_custom/changelog.tmpl +++ b/pylons_app/templates/monoblue_custom/changelog.tmpl @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*- {header} {repo|escape}: changelog diff --git a/pylons_app/templates/monoblue_custom/changelogentry.tmpl b/pylons_app/templates/monoblue_custom/changelogentry.tmpl --- a/pylons_app/templates/monoblue_custom/changelogentry.tmpl +++ b/pylons_app/templates/monoblue_custom/changelogentry.tmpl @@ -1,3 +1,4 @@ +## -*- coding: utf-8 -*-

{desc|strip|firstline|escape|nonempty} {inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}