durusmail: quixote-users: Re: upload binary file/current state of quixote
upload binary file
2006-03-07
Tom Lesters
2006-03-08
Mike Orr
upload binary file/current state of quixote
2006-03-08
Bo Yang
Re: upload binary file/current state of quixote
2006-03-08
mario ruggier
2006-03-08
David Binger
2006-03-09
Bo Yang
2006-03-08
Mike Orr
Quixote, QP, the future...?
2006-03-08
Titus Brown
2006-03-09
David Binger
2006-03-09
Graham Fawcett
2006-03-09
Graham Fawcett
2006-03-09
David Binger
2006-03-09
Mike Orr
2006-03-09
David Binger
2006-03-09
Bo Yang
2006-03-09
Bo Yang
Re: upload binary file/current state of quixote
Neil Schemenauer
Bo Yang  wrote:
> 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:

reply