~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/dispatch/request.py

  • Committer: mattgiuca
  • Date: 2008-02-05 23:29:48 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:426
tutorial: Again refactored present_worksheet so it now recurses on all nodes.
Had to manually write out element nodes in order to recurse on their children.
Now able to present problem elements from anywhere in the DOM tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
224
224
 
225
225
        if not self.headers_written:
226
226
            self.__writeheaders()
227
 
        self.apache_req.write(string, flush)
 
227
        if isinstance(string, unicode):
 
228
            # Encode unicode strings as UTF-8
 
229
            # (Otherwise cannot handle being written to a bytestream)
 
230
            self.apache_req.write(string.encode('utf8'), flush)
 
231
        else:
 
232
            # 8-bit clean strings just get written directly.
 
233
            # This includes binary strings.
 
234
            self.apache_req.write(string, flush)
228
235
 
229
236
    def flush(self):
230
237
        """Flushes the output buffer."""
270
277
        interface if porting away from mod_python."""
271
278
        # Cache the session object
272
279
        if not hasattr(self, 'session'):
273
 
            self.session = Session.Session(self.apache_req)
 
280
            self.session = Session.FileSession(self.apache_req)
274
281
        return self.session
275
282
 
276
283
    def get_fieldstorage(self):