import re
class RemoveSelfLinks:
def process_response(self, request, response):
if response.status_code == 200:
link = request.META['PATH_INFO']
response.content = \
re.sub( \
r']+)href="%s"([^>]*)>(.*?(?!)[^<]*)' % link, \
r'\3', \
response.content)
return response