Reputation: 1519
I'm following this tutorial to fix a cache problem, since I'm using google analytics. After trying the code, I'm getting
A server error occurred. Please contact the administrator.
middleware.py
from django.middleware.cache import UpdateCacheMiddleware
import re
class SmartUpdateCacheMiddleware(UpdateCacheMiddleware):
STRIP_RE=re.compile(r'\b(_[^=]+=.+?(?:; |$))' )
def process_request(self,request):
cookie=self.STRIP_RE.sub(",request.META.get('HTTP_COOKIE',")) #error
request.META['HTTP_COOKIE']=cookie
In my cmd terminal I'm getting this error
File "C:\Python27\Scripts\env\Scripts\meek\meek\middleware.py", line 9
cookie=self.STRIP_RE.sub(",request.META.get('HTTP_COOKIE',"))
I tried fixing it but it's not working.
Upvotes: 0
Views: 107
Reputation: 57398
You seem to have cut-and-pasted with a typo. It should be:
cookie = self.STRIP_RE.sub('', request.META.get('HTTP_COOKIE', ''))
You collapsed the double single quotes into a single double quote mark:
cookie=self.STRIP_RE.sub(",request.META.get('HTTP_COOKIE',"))
^ ^
Upvotes: 5