1 2 3 4 5 6 7 8 9 10 11 12 | 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'<a([^>]+)href="%s"([^>]*)>(.*?(?!</a>)[^<]*)</a>' % link, \
r'<span \1 \2>\3</span>', \
response.content)
return response
|
More like this
- Page numbers with ... like in Digg by Ciantic 4 years, 1 month ago
- True links in the admin list by svetlyak 5 years, 8 months ago
- Flash Message Template Tag by rtconner 5 years, 10 months ago
- nofollow filter by svetlyak 5 years, 10 months ago
- Per-site vary cache on language by fneumann 5 years, 7 months ago
Comments