1. Jesper Nøhr
  2. django-fakesi


Jesper Nøhr  committed 3e1005b

actually there's a big difference between nginx and ssi

  • Participants
  • Parent commits b9f3299
  • Branches master

Comments (0)

Files changed (2)

File fakesi/middleware.py

View file
  • Ignore whitespace
         def nginx_ssi(request):
             return request.META.get('HTTP_NGINX_SSI', 'off') == 'on'
-        request.is_ssi = lambda *a, **kwa: nginx_ssi(request, *a, **kwa)
+        def is_ssi(request):
+            return request.GET.get('ssi', '0') == '1'
+        request.is_nginx = lambda *a, **kwa: nginx_ssi(request, *a, **kwa)
+        request.is_ssi = lambda *a, **kwa: is_ssi(request, *a, **kwa)
     def process_response(self, request, response):
-        if request.is_ssi():
+        if request.is_nginx():
             return response
             def ssi_include(match):

File fakesi/tests/templates/ssi.html

View file
  • Ignore whitespace
 <p>I say, this is from SSI! I see you as '<b  id="user">{{ request.user }}</b>', on path '<b id="path">{{ request.path }}</b>'</p>
 <p>My variables are {{ request.GET }}</p>
-<p>You are from nginx: <b id="nginx">{% if request.is_ssi %}Yep!{% else %}Nope.{% endif %}</b></p>
+<p>You are from nginx: <b id="nginx">{% if request.is_nginx %}Yep!{% else %}Nope.{% endif %}</b> and SSI: <b id="ssi">{{ request.is_ssi }}</b></p>
 <p>Random number: <b id="random">{{ random }}</b></p>