Danek Duvall wrote:
On Tue, Nov 20, 2007 at 02:54:30PM +0000, Trevor Watson wrote:

http://cr.opensolaris.org/~trevw/pkg-226/webrev2/

Why are you passing in a formatting string to send_static(), rather than
just a path relative to the content root?

Good question!
Since the content root probably applies to all static content, I should just prefix the supplied file name with the formatting string/content root.

send_static() should only send a 404 when the open failed because the file
wasn't there.  Any other problem in the method should send a 500.  And yes,
it'd be nice to see content-length, too.  :)

I couldn't think of any other obvious exceptions which would be generated by the call to 'open', but there is no harm in catching everything other than IOError and returning 500.

Since you agree, I'll add content length header too.

The comment on lines 50,51 isn't the entire story -- we also don't want the
close() to get lost because something before it but after the open()
succeeded threw an exception.  Python will eventually garbage collect the
fd, but on a large server, we don't want to push the number of open fds too
much.  The normal way of doing this would be to add an else clause to the
try/except block, but if you end up breaking up the block to handle
individual portions of it, then that wouldn't be as smooth.

Thanks,
Trev

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to