def callback(cls, request, result, context):
     return [
         commands.set_content(render_to_string(
             'varnish-bans-manager/core/bans/status.html', {
                 'form': StatusForm(cache=result['cache']),
                 'cache': result['cache'],
                 'bans': result['bans'],
                 'errors': result['errors'],
             },
             context_instance=RequestContext(request)))
     ]
Exemple #2
0
 def callback(cls, request, result, context):
     return [
         commands.set_content(
             render_to_string('varnish-bans-manager/core/bans/status.html',
                              {
                                  'form': StatusForm(cache=result['cache']),
                                  'cache': result['cache'],
                                  'bans': result['bans'],
                                  'errors': result['errors'],
                              },
                              context_instance=RequestContext(request)))
     ]
Exemple #3
0
 def wrapped(request, *args, **kwargs):
     result = fn(request, *args, **kwargs)
     if isinstance(result, HttpResponse):
         return result
     else:
         if request.is_ajax():
             contents = render_to_string(
                 result['template'],
                 result['context'],
                 context_instance=RequestContext(request))
             return HttpResponseAjax([
                 set_content(contents),
             ], request)
         else:
             return render_to_response(
                 result['template'],
                 result['context'],
                 context_instance=RequestContext(request))