changeset 1064:a8ea94a0cbe8

emit_http_headers: better docs, _emit_http_headers raises NotImplementedError in base class
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 26 Jul 2006 12:54:03 +0200
parents e30022bc628f
children cd5c2aed0c31
files MoinMoin/request/__init__.py
diffstat 1 files changed, 20 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/request/__init__.py	Wed Jul 26 12:40:54 2006 +0200
+++ b/MoinMoin/request/__init__.py	Wed Jul 26 12:54:03 2006 +0200
@@ -1124,12 +1124,17 @@
         self.emit_http_headers(more_headers)
 
     def emit_http_headers(self, more_headers=[]):
-        """ emit http headers after some preprocessing,
-            for emitting, it calls the server specific _emit_http_headers
-            method with a list of headers in this FIXED order:
-            1. status header (always present and valid, e.g. "200 OK")
-            2. content type header (always present)
-            3. other headers (optional)
+        """ emit http headers after some preprocessing / checking
+
+            Makes sure we only emit headers once.
+            Encodes to ASCII if it gets unicode headers.
+            Make sure we have exactly one Content-Type and one Status header.
+            Make sure Status header string begins with a integer number.
+        
+            For emitting, it calls the server specific _emit_http_headers
+            method.
+
+            @param more_headers: list of additional header strings
         """
         # Send headers only once
         if getattr(self, 'sent_headers', False):
@@ -1172,6 +1177,15 @@
         #from pprint import pformat
         #sys.stderr.write(pformat(headers))
 
+    def _emit_http_headers(self, headers):
+        """ server specific method to emit http headers.
+        
+            @param headers: a list of http header strings in this FIXED order:
+                1. status header (always present and valid, e.g. "200 OK")
+                2. content type header (always present)
+                3. other headers (optional)
+        """
+        raise NotImplementedError
 
     def setHttpHeader(self, header):
         """ Save header for later send.