SVN: r25922 - trunk/quixote

David Binger <dbinger-fVcApmY9cLvQ3/1i3zOLAti2O/[email protected]> Sat, 29 Jan 2005 08:08:27 -0500
Newsgroups gmane.comp.web.quixote.cvs
Message-ID <[email protected]>
Author: dbinger
Date: 2005-01-29 08:08:26 -0500 (Sat, 29 Jan 2005)
New Revision: 25922

Modified:
    trunk/quixote/http_response.py
Log:
nas: Add class variables with default values for content_type and 
charset.


Modified: trunk/quixote/http_response.py
===================================================================
--- trunk/quixote/http_response.py	2005-01-28 21:27:13 UTC (rev 25921)
+++ trunk/quixote/http_response.py	2005-01-29 13:08:26 UTC (rev 25922)
@@ -133,12 +133,15 @@
          else's problem.
      """

-    def __init__(self, status=200, body=None, charset='iso-8859-1'):
+    DEFAULT_CONTENT_TYPE = 'text/html'
+    DEFAULT_CHARSET = 'iso-8859-1'
+
+    def __init__(self, status=200, body=None, content_type=None, 
charset=None):
          """
          Creates a new HTTP response.
          """
-        self.content_type = 'text/html'
-        self.charset = charset
+        self.content_type = content_type or self.DEFAULT_CONTENT_TYPE
+        self.charset = charset or self.DEFAULT_CHARSET
          self.set_status(status)
          self.headers = {}