Mercurial > public > src > rhodecode
changeset 21:fac1f62a1d71
Wrapped into mako templates,
changed templates info. Added session and cache middleware.
author | Marcin Kuzminski |
---|---|
date | Sun, 28 Feb 2010 02:24:44 +0100 |
parents | bbaab7501c1a |
children | 3142616771cd |
files | pylons_app/config/middleware.py pylons_app/controllers/hg.py pylons_app/templates/monoblue_custom/changelog.tmpl pylons_app/templates/monoblue_custom/index.tmpl pylons_app/templates/monoblue_custom/shortlog.tmpl |
diffstat | 5 files changed, 30 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/pylons_app/config/middleware.py Sun Feb 28 01:52:38 2010 +0100 +++ b/pylons_app/config/middleware.py Sun Feb 28 02:24:44 2010 +0100 @@ -41,6 +41,8 @@ # Routing/Session/Cache Middleware app = RoutesMiddleware(app, config['routes.map']) + app = SessionMiddleware(app, config) + app = CacheMiddleware(app, config) if asbool(full_stack): # Handle Python exceptions
--- a/pylons_app/controllers/hg.py Sun Feb 28 01:52:38 2010 +0100 +++ b/pylons_app/controllers/hg.py Sun Feb 28 02:24:44 2010 +0100 @@ -13,11 +13,23 @@ log = logging.getLogger(__name__) class HgController(BaseController): - def index(self): - return g.hgapp(request.environ, self.start_response) + + def __before__(self): + c.repos_prefix = 'etelko' + def view(self, *args, **kwargs): - return g.hgapp(request.environ, self.start_response) + 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: + return response + + #wrap the murcurial response in a mako template. + template = Template("".join(response), + lookup = request.environ['pylons.pylons']\ + .config['pylons.g'].mako_lookup) + + return template.render(g = g, c = c, session = session, h = h) def add_repo(self, new_repo): c.staticurl = g.statics
--- a/pylons_app/templates/monoblue_custom/changelog.tmpl Sun Feb 28 01:52:38 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/changelog.tmpl Sun Feb 28 02:24:44 2010 +0100 @@ -24,10 +24,13 @@ <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> - <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}</li> - </ul> + <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li> + + </div> - + <ul class="submenu"> + {archives%archiveentry} + </ul> <h2 class="no-link no-border">changelog</h2> <div> {entries%changelogentry}
--- a/pylons_app/templates/monoblue_custom/index.tmpl Sun Feb 28 01:52:38 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/index.tmpl Sun Feb 28 02:24:44 2010 +0100 @@ -5,7 +5,7 @@ <body> <div id="container"> <div class="page-header"> - <h1> Mercurial Repositories</h1> + <h1>${c.repos_prefix} Mercurial Repositories</h1> <ul class="page-nav"> </ul> </div>
--- a/pylons_app/templates/monoblue_custom/shortlog.tmpl Sun Feb 28 01:52:38 2010 +0100 +++ b/pylons_app/templates/monoblue_custom/shortlog.tmpl Sun Feb 28 02:24:44 2010 +0100 @@ -24,18 +24,20 @@ <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li> <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li> <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li> - <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}</li> + <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li> </ul> </div> - + <ul class="submenu"> + {archives%archiveentry} + </ul> <h2 class="no-link no-border">shortlog</h2> <table> -{entries%shortlogentry} + {entries%shortlogentry} </table> <div class="page-path"> -{changenav%navshortentry} + {changenav%navshortentry} </div> {footer}