summaryrefslogtreecommitdiff
path: root/paste/debug
diff options
context:
space:
mode:
authorianb <devnull@localhost>2009-01-29 18:32:16 +0000
committerianb <devnull@localhost>2009-01-29 18:32:16 +0000
commit417afb105e3d5d8a57ef013d1cd708b371755855 (patch)
tree568e2a012d566d09736091a2e3d87fb172415ecc /paste/debug
parent05439a84351100194eaedd2bf15174347b8c5803 (diff)
downloadpaste-417afb105e3d5d8a57ef013d1cd708b371755855.tar.gz
Apply patch to fix some problems with wdg_validate middleware
Diffstat (limited to 'paste/debug')
-rw-r--r--paste/debug/wdg_validate.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/paste/debug/wdg_validate.py b/paste/debug/wdg_validate.py
index 119c2d7..7f0862c 100644
--- a/paste/debug/wdg_validate.py
+++ b/paste/debug/wdg_validate.py
@@ -72,9 +72,13 @@ class WDGValidateMiddleware(object):
# @@: Should capture encoding too
html_errors = self.call_wdg_validate(
self.wdg_path, ops, page)
- if not html_errors:
- return [page]
- return self.add_error(page, html_errors)
+ if html_errors:
+ page = self.add_error(page, html_errors)[0]
+ headers.remove(
+ ('Content-Length',
+ str(wsgilib.header_value(headers, 'content-length'))))
+ headers.append(('Content-Length', str(len(page))))
+ return [page]
def call_wdg_validate(self, wdg_path, ops, page):
if subprocess is None:
@@ -99,7 +103,7 @@ class WDGValidateMiddleware(object):
if match:
return [html_page[:match.start()]
+ add_text
- + html_page[match.end():]]
+ + html_page[match.start():]]
else:
return [html_page + add_text]