upload binary file
2006-03-07
Tom Lesters2006-03-08
Mike Orrupload binary file/current state of quixote
2006-03-08
Bo YangRe: upload binary file/current state of quixote
2006-03-08
Neil Schemenauer2006-03-08
mario ruggier2006-03-08
David Binger2006-03-09
Bo Yang2006-03-08
Mike OrrQuixote, QP, the future...?
2006-03-08
Titus Brown2006-03-09
David Binger2006-03-09
Graham Fawcett2006-03-09
Graham Fawcett2006-03-09
David Binger2006-03-09
Mike Orr2006-03-09
David Binger2006-03-09
Bo Yang2006-03-09
william@opensource4you.com2006-03-09
Bo YangRe: upload binary file/current state of quixote
Neil Schemenauer
Bo Yangwrote: > need for a simpler way to determine upload size is the main reason I > decided to use quixote 1.x instead 2-alpha when our site (douban.com) > was launched in march 2005. today we're still with 1.x. Hmm, that hardly sounds like a show stopper. Would the attached patch do the trick for you (it adds a get_size() method to the Upload object)? Any other reasons why you don't want to migrate to Quixote 2? > by the way, talking about current state of Quixote, douban.com is now > getting 450,000 page views a day. 100% dynamically generated by qx. I > might be wrong but, it seems we are a busier site than every other > known ROR/django/TG installations in the world. Awesome. I guess I need to work on my Chinese so I can read the site. :-) Neil Index: http_request.py =================================================================== --- http_request.py (revision 27723) +++ http_request.py (working copy) @@ -8,6 +8,7 @@ import re import string +import os import tempfile import urllib import rfc822 @@ -676,7 +677,16 @@ def close(self): self.fp.close() + def get_size(self): + """Return the size of the file, in bytes. + """ + if self.fp is None: + return 0 + else: + return os.fstat(self.fp.fileno()).st_size + + class LineInput: r""" A wrapper for an input stream that has the following properties: