List Info

Thread: upload binary file/current state of quixote




upload binary file/current state of quixote
user name
2006-03-08 21:04:30
Bo Yang <boyangmac.com> 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:

_______________________________________________
Quixote-users mailing list
Quixote-usersmems-exchange.org
http://mail.mems-exchange.org/mailman/listinfo/quixo
te-users
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )