ContributedMiddleware: quickComment.py
| File quickComment.py, 332 bytes (added by scum, 2 years ago) |
|---|
| Line | |
|---|---|
| 1 | import re |
| 2 | regx_extractComments = re.compile('(\{\#.*?\#\})', re.DOTALL) |
| 3 | |
| 4 | class 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 |
