Cheetah inherits write() directly from HTTPResponse, which is not a very
user friendly method.  I found that out when I tried to write a
dictionary out for debugging.  WebKit.Page has write and writeln that
will print a dictionary or just about anything else, those functions
could either be moved up a little in the inheritance tree, or
SkeletonPage could have similar functions.

There is a WebKit problem here though I think, WebKit.ExceptionHandler
doesn't convert the things it prints to string before calling write() so
it fails too unless the servlet inherits from Page which has the
friendly version of write().

The traceback below shows HTTPResponse.write failing to write a
dictionary and that's OK since it only expects strings.  Then
ExceptionHandler fails because it tries to write the same dictionary and
that's not OK.

So would there be much of a performance hit to replace HTTPResponse's
write with the one in Page?  And could we add writeln while we're at it?

Regards,
Jeff

WebKit.HTTPResonse:
        def write(self, charstr=None):
                """
                Write charstr to the response stream.
                """
                if charstr: self._strmOut.write(charstr)
                if not self._committed and self._strmOut._needCommit:
                        self.commit()

WebKit.Page:
        def write(self, *args):
                for arg in args:
                        self._response.write(str(arg))

        def writeln(self, *args):
                for arg in args:
                        self._response.write(str(arg))
                self._response.write('\n')

    5  2002-06-18 14:38:56  /partner/city.py/zipcode/33467
[Tue Jun 18 14:38:56 2002] [error] WebKit: Error while executing script
/home/jeff/jeff/partner/www/city.py
Traceback (most recent call last):
  File "./WebKit/Application.py", line 397, in dispatchRequest
  File "./WebKit/HTTPResponse.py", line 183, in deliver
  File "./WebKit/HTTPResponse.py", line 194, in commit
  File "./WebKit/ASStreamOut.py", line 151, in commit
  File "./WebKit/ThreadedAppServer.py", line 428, in flush
  File "./WebKit/ASStreamOut.py", line 69, in flush
  File "/usr/local/lib/python2.2/string.py", line 131, in join
    return sep.join(words)
TypeError: sequence item 6: expected string, dict found
Traceback (most recent call last):
  File "./WebKit/ThreadedAppServer.py", line 287, in threadloop
  File "./WebKit/ThreadedAppServer.py", line 526, in handleRequest
  File "./WebKit/Application.py", line 350, in dispatchRawRequest
  File "./WebKit/Application.py", line 405, in dispatchRequest
  File "./WebKit/Application.py", line 1027, in
handleExceptionInTransaction
  File "./WebKit/ExceptionHandler.py", line 93, in __init__
  File "./WebKit/ExceptionHandler.py", line 130, in work
  File "./WebKit/HTTPResponse.py", line 153, in write
  File "./WebKit/ASStreamOut.py", line 163, in write
  File "./WebKit/ThreadedAppServer.py", line 428, in flush
  File "./WebKit/ASStreamOut.py", line 69, in flush
  File "/usr/local/lib/python2.2/string.py", line 131, in join
    return sep.join(words)
TypeError: sequence item 6: expected string, dict found




----------------------------------------------------------------------------
                   Bringing you mounds of caffeinated joy
                   >>>     http://thinkgeek.com/sf    <<<

_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to