Mercurial > kallithea
diff pylons_app/controllers/hg.py @ 20:bbaab7501c1a
Added custom templates, did over check of code to make it work.
Added templating for add repository, and styling. App globals now handles our custom static files. (logo etc can be changed)
author | Marcin Kuzminski |
---|---|
date | Sun, 28 Feb 2010 01:52:38 +0100 |
parents | 5f30a6d558dc |
children | fac1f62a1d71 |
line wrap: on
line diff
--- a/pylons_app/controllers/hg.py Sat Feb 27 17:40:37 2010 +0100 +++ b/pylons_app/controllers/hg.py Sun Feb 28 01:52:38 2010 +0100 @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- import logging -from pylons_app.lib.base import BaseController +from pylons_app.lib.base import BaseController, render from pylons import c, g, session, h, request from mako.template import Template from pprint import pprint @@ -20,27 +20,26 @@ return g.hgapp(request.environ, self.start_response) def add_repo(self, new_repo): - tmpl = u''' - <html> - <body> - %(msg)s%(new_repo)s!<br \> - <a href="/">repos</a> - </body> - </html> - ''' + c.staticurl = g.statics + #extra check it can be add since it's the command if new_repo == 'add': - return [tmpl % ({'new_repo':'', 'msg':'you basstard ! this repo is a command'})] + c.msg = 'you basstard ! this repo is a command' + c.new_repo = '' + return render('add.html') new_repo = new_repo.replace(" ", "_") new_repo = new_repo.replace("-", "_") try: self._create_repo(new_repo) + c.new_repo = new_repo + c.msg = 'added repo' except Exception as e: - return [tmpl % ({'new_repo':' Exception when adding: ' + new_repo, 'msg':str(e)})] + c.new_repo = 'Exception when adding: %s' % new_repo + c.msg = str(e) - return [tmpl % ({'new_repo':new_repo, 'msg':'added repo: '})] + return render('add.html') def _check_repo(self, repo_name): p = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))