Wednesday, September 12, 2012

Django Snippets: how to set p3p header in python


how to set p3p header in python

https://github.com/jjanssen/django-p3p
Django P3P makes it easier to set P3P HTTP headers to prevent session loss. — Read more
2 months ago

http://djangosnippets.org/snippets/786/

P3P Headers for iframes

1
2
3
4
def index(request):
    response = render_to_response('mytemplate.html')
    response["P3P"] = 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'
    return response








More like this

  1. Compact P3P policy header injection middleware by mwolgemuth 3 years, 11 months ago
  2. Avoid IE Brokenness When using Vary and Attachments by axiak 5 years, 5 months ago
  3. Extended db cache backend with 'filter() / LIKE' support (and now scheduled cache clean!) by sleepycal 2 years, 8 months ago
  4. Internet Explorer Redirect Decorator by johnboxall 3 years, 11 months ago
  5. Foreign Key list_filter wthout custom FilterSpec by haileris23 2 years, 7 months ago


http://djangosnippets.org/snippets/1084/

Compact P3P policy header injection middleware

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
P3P_COMPACT = 'some string' # I import this from a global constants file
# eg. P3P_COMPACT='CP="CAO DSP CURa ADMa DEVa TAIa CONa OUR DELa BUS IND PHY ONL UNI PUR COM NAV DEM STA"'

class MiddlewareResponseInjectP3P(object):
    def __init__(self):
        self.process_response = self.inject

    def inject(self, request, response):
        response['P3P'] = P3P_COMPACT
        return response
















No comments:

Post a Comment