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

More like this

  1. Search Engine Referrer info in request by zenx 5 years, 4 months ago
  2. Subdomain Middleware by xhenxhe 5 years, 6 months ago
  3. Interactive Profiling Middleware by sfllaw 3 years, 8 months ago
  4. Logging solution for mod_python/FCGI by mikeivanov 6 years, 7 months ago
  5. Remove self links middleware by svetlyak 6 years ago

Comments

EmilStenstrom (on November 24, 2011):

Excellent, thanks!

#

(Forgotten your password?)