On Dec 26, 2007 11:49 PM, Jack <[EMAIL PROTECTED]> wrote:
>
> Looks like someone else has been bitten as well.
>
> shutils.copyfileobj works fine if the file is open as binary. The
> problem seems to be in SimpleHTTPServer.send_head(), which opens "css"
> files as text file.
>
> I wonder if it's necessary to differentiate a text file and a binary
> file here at all. Why not always open as "rb".
Here is a monkey patch to fix it.
# httppatch.py
from SimpleHTTPServer import SimpleHTTPRequestHandler
send_head = SimpleHTTPRequestHandler.send_head
def new_send_head(*a, **kw):
print 'new_send_head', a, kw
f = send_head(*a, **kw)
return f and open(f.name, 'rb')
SimpleHTTPRequestHandler.send_head = new_send_head
import this module before calling web.run.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---