changeset 1071:64e513264aed

cleanup, less header logging
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 27 Jul 2006 21:18:46 +0200
parents 054a3d3d8dfe
children c1f5ee67a02b
files MoinMoin/request/TWISTED.py MoinMoin/request/__init__.py
diffstat 2 files changed, 8 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/request/TWISTED.py	Thu Jul 27 11:28:35 2006 +0200
+++ b/MoinMoin/request/TWISTED.py	Thu Jul 27 21:18:46 2006 +0200
@@ -137,7 +137,3 @@
         #self.twistd.finish()
         raise MoinMoinFinish
 
-    #done by _emit_http_headers now:
-    #def setResponseCode(self, code, message=None):
-    #    self.twistd.setResponseCode(code, message)
-
--- a/MoinMoin/request/__init__.py	Thu Jul 27 11:28:35 2006 +0200
+++ b/MoinMoin/request/__init__.py	Thu Jul 27 21:18:46 2006 +0200
@@ -9,7 +9,7 @@
 
 import os, re, time, sys, cgi, StringIO
 import copy
-from MoinMoin import config, wikiutil, user, caching
+from MoinMoin import config, wikiutil, user, caching, error
 from MoinMoin.util import IsWin9x
 
 
@@ -974,7 +974,6 @@
         if resultcode == 503:
             headers.append('Retry-After: %d' % self.cfg.surge_lockout_time)
         self.emit_http_headers(headers)
-        #self.setResponseCode(resultcode)
         self.write(msg)
         self.forbidden = True
 
@@ -1136,21 +1135,22 @@
 
             @param more_headers: list of additional header strings
         """
+        headers = more_headers + getattr(self, 'user_headers', [])
+        self.user_headers = []
+
         # Send headers only once
         sent_headers = getattr(self, 'sent_headers', 0)
         self.sent_headers = sent_headers + 1
         if sent_headers:
-            raise("emit_http_headers called multiple times(%d)! Headers: %r" % (sent_headers, more_headers))
-            self.log("emit_http_headers called multiple times(%d)! Headers: %r" % (sent_headers, more_headers))
-            return
-        else:
-            self.log("Notice: emit_http_headers called first time. Headers: %r" % more_headers)
+            raise error.InternalError("emit_http_headers called multiple times(%d)! Headers: %r" % (sent_headers, headers))
+        #else:
+        #    self.log("Notice: emit_http_headers called first time. Headers: %r" % headers)
 
         content_type = None
         status = None
         headers = []
         # assemble complete list of http headers
-        for header in more_headers + getattr(self, 'user_headers', []):
+        for header in headers:
             if isinstance(header, unicode):
                 header = header.encode('ascii')
             key, value = header.split(':', 1)