Commits

bbangert  committed 007eb42

Switched to holding content as an array internally

  • Participants
  • Parent commits 98a5b12

Comments (0)

Files changed (1)

File paste/wsgiwrappers.py

     def __init__(self, content='', mimetype=None, code=200):
         if not mimetype:
             mimetype = "%s; charset=%s" % (settings['content_type'], settings['charset'])
-        self.content = content
+        self.content = [content]
         self.headers = HeaderDict()
         self.headers['Content-Type'] = mimetype
         self.cookies = SimpleCookie()
         "Full HTTP message, including headers"
         return '\n'.join(['%s: %s' % (key, value)
             for key, value in self.headers.items()]) \
-            + '\n\n' + self.content
+            + '\n\n' + ''.join(self.content)
     
     def has_header(self, header):
         "Case-insensitive check for a header"
         necessary.
         """
         if isinstance(self.content, unicode):
-            return self.content.encode(encoding)
+            return [''.join(self.content).encode(encoding)]
         return self.content
     
     def wsgi_response(self, encoding=None):
         response_headers = self.headers.items()
         for c in self.cookies.values():
             response_headers.append(('Set-Cookie', c.output(header='')))
-        output = [self.get_content_as_string(encoding)]
+        output = self.get_content_as_string(encoding)
         return status, response_headers, output
     
     # The remaining methods partially implement the file-like object interface.
     # See http://docs.python.org/lib/bltin-file-objects.html
     def write(self, content):
-        self.content += content
+        self.content.append(content)
 
     def flush(self):
         pass