From cb97e07a9c9fc895450bf78bb566f6691bd6452a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toshio=20=E3=81=8F=E3=82=89=E3=81=A8=E3=81=BF?= Date: Tue, 4 Mar 2008 23:26:34 +0000 Subject: [PATCH] Fix the root url to return json data even when we'd normally redirect. --- fas/fas/controllers.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fas/fas/controllers.py b/fas/fas/controllers.py index 2aae449..678f9ff 100644 --- a/fas/fas/controllers.py +++ b/fas/fas/controllers.py @@ -63,10 +63,15 @@ class Root(controllers.RootController): @expose(template="fas.templates.welcome", allow_json=True) def index(self): if turbogears.identity.not_anonymous(): + if 'tg_format' in request.params \ + and request.params['tg_format'] == 'json': + # redirects don't work with JSON calls. This is a bit of a + # hack until we can figure out something better. + return dict() turbogears.redirect('/home') return dict(now=time.ctime()) - @expose(template="fas.templates.home") + @expose(template="fas.templates.home", allow_json=True) @identity.require(identity.not_anonymous()) def home(self): return dict()