Skip to content

Commit

Permalink
Don't instantiate a TemplateAPI if there's no request.
Browse files Browse the repository at this point in the history
  • Loading branch information
dnouri committed Mar 17, 2012
1 parent cd72052 commit e961bc4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kotti/views/util.py
Expand Up @@ -50,8 +50,9 @@ def render_view(context, request, name='', secure=True):

def add_renderer_globals(event):
if event['renderer_name'] != 'json':
api = getattr(event['request'], 'template_api', None)
if api is None:
request = event['request']
api = getattr(request, 'template_api', None)
if api is None and request is not None:
api = template_api(event['context'], event['request'])
event['api'] = api

Expand Down

0 comments on commit e961bc4

Please sign in to comment.