[CMF-checkins] CVS: CMF - slurp_release.py:1.2.10.3
Sidnei da Silva
sidnei at awkly.org
Mon Mar 21 12:12:27 EST 2005
Update of /cvs-repository/CMF
In directory cvs.zope.org:/tmp/cvs-serv27446
Modified Files:
Tag: CMF-1_4-branch
slurp_release.py
Log Message:
Add some more headers to try to improve the upload story.
=== CMF/slurp_release.py 1.2.10.2 => 1.2.10.3 ===
--- CMF/slurp_release.py:1.2.10.2 Fri Mar 18 08:30:14 2005
+++ CMF/slurp_release.py Mon Mar 21 12:12:26 2005
@@ -7,6 +7,7 @@
import httplib
import getopt
import base64
+import mimetypes
CVSROOT = ':pserver:anonymous at cvs.zope.org:/cvs-repository'
@@ -169,11 +170,19 @@
""" Upload the zipfile for the release to the dogbowl.
"""
URL = ( '/Products/CMF/%s/%s' % ( self._version_id, filename ) )
- body = open( filename ).read()
+ body = open(filename, 'rb').read()
conn = httplib.HTTPConnection( 'www.zope.org' )
print 'PUTting file, %s, to URL, %s' % ( filename, URL )
- conn.request( 'PUT', URL, body, self._getAuthHeaders() )
+ headers = self._getAuthHeaders()
+
+ new_hdrs = {'Content-Length':len(body)}
+ content_type, content_enc = mimetypes.guess_type(URL)
+ new_hdrs['Content-Type'] = content_type
+ new_hdrs['Content-Encoding'] = content_enc
+ new_hdrs.update(headers)
+
+ conn.request('PUT', URL, body, new_hdrs)
response = conn.getresponse()
if int( response.status ) not in ( 200, 201, 204, 302 ):
raise ValueError, 'Failed: %s (%s)' % ( response.status
More information about the CMF-checkins
mailing list