[CentralOH] web.py

Mark Erbaugh mark at microenh.com
Tue Oct 21 16:56:04 CEST 2008


On Tue, 2008-10-21 at 10:01 -0400, Greg Singer wrote:
> I think the only solution (besides changing httpserver.py) is
> something like the below, which I haven't tested but I think should
> work:
> 
> url = (
>   "/data/(.*)",  "StaticContent"
> )
> 
> class StaticContent:
>   def GET(self, fname):
>     try:
>       i = open("static/" + fname)
>       print i.read()
>     except IOError:
>       web.notfound()

Greg,

Thanks. I already tried that and found that the binary data was messing
up the file transfer.

I think binary data can be sent, but it would require building mime
headers and encoding the data stream.  Modifying httpserver.py was much
easier.

Maybe I should suggest to the developers the ability to add multiple
static folders.

Mark



More information about the CentralOH mailing list