[Pypi-checkins] r928 - trunk/pypi

martin.von.loewis python-checkins at python.org
Sun Jul 10 21:21:18 CEST 2011


Author: martin.von.loewis
Date: Sun Jul 10 21:21:18 2011
New Revision: 928

Modified:
   trunk/pypi/gae.py
Log:
Fix various bugs.


Modified: trunk/pypi/gae.py
==============================================================================
--- trunk/pypi/gae.py	(original)
+++ trunk/pypi/gae.py	Sun Jul 10 21:21:18 2011
@@ -2,7 +2,7 @@
 # GAE GETs an action gae_file, giving GAE host and a secret
 # PyPI GETs /mkupload/secret, learning path and upload session
 # PyPI POSTs to upload session
-import urllib2, httplib, threading, os, binascii, urlparse
+import urllib2, httplib, threading, os, binascii, urlparse, errno
 
 POST="""\
 --%(boundary)s
@@ -14,6 +14,10 @@
 
 %(path)s
 --%(boundary)s
+Content-Disposition: form-data; name="%(presence)s"
+
+1
+--%(boundary)s
 Content-Disposition: form-data; name="file"; filename="%(path)s"
 Content-Type: application/octet-stream
 
@@ -30,10 +34,11 @@
     host, session = urlparse.urlsplit(url)[1:3]
     try:
         data = open(srcdir+"/"+path).read()
+        presence = "present"
     except IOError, e:
-        if errno == errno.ENOENT:
+        if e.errno == errno.ENOENT:
             # file has been deleted
-            session += '&deleted=1'
+            presence = "deleted"
             data = ''
         else:
             # some other problem with file. GAE will request transfer


More information about the Pypi-checkins mailing list