Code

ContributedMiddleware: quickComment.py

File quickComment.py, 332 bytes (added by scum, 8 years ago)

QuickComment allows use of {# and #} to comment out code.

Line 
1import re
2regx_extractComments = re.compile('(\{\#.*?\#\})', re.DOTALL)
3
4class QuickCommentMiddleware:
5        def process_response(self, request, response):
6                if response.has_header and response.headers.get("Content-Type", "")[0:9] == "text/html":
7                        response.content = regx_extractComments.sub( "", response.content)
8                return response
9