Changeset 3da9ea in indico
- Timestamp:
- 06/29/11 15:34:07 (23 months ago)
- Branches:
- master, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
- Children:
- 91cb2e
- Parents:
- bcee0f
- File:
-
- 1 edited
-
indico/MaKaC/export/fileConverter.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/export/fileConverter.py
ra370da r3da9ea 21 21 import tempfile, os, base64, socket 22 22 import mimetypes, urlparse, simplejson 23 import httplib 24 25 from MaKaC.common.logger import Logger 23 26 from MaKaC.common.Configuration import Config 24 27 from MaKaC import conference 25 from MaKaC.common.httpTimeout import HTTPWithTimeout26 28 27 29 #URL_RESPONSE = "http://pcdh20.cern.ch/indico/getConvertedFile.py" … … 79 81 #writeLog("Local file to upload invalid") 80 82 return False 81 fic =open(localFile, "rb")82 segnum =083 fic = open(localFile, "rb") 84 segnum = 0 83 85 segsize = SEGMENT_SIZE 84 86 filekey = 'segfile' 85 try :86 h = HTTPWithTimeout(host, timeout = 5)87 except Exception, e:88 #writeLog("Error : Can't connect to host:%s"%host)89 return False90 87 91 88 while 1: … … 148 145 149 146 try: 150 h.putrequest('POST', selector) 151 h.putheader('content-type', content_type) 152 h.putheader('content-length', str(len(body))) 153 h.endheaders() 154 h.send(body) 155 except: 156 #writeLog("Exception while sending file to the CDSconv server") 157 pass 158 try: 159 h.getreply() 147 Logger.get('cdsconv').info("Uploading %s to %s" % (localFile, host)) 148 h = httplib.HTTPConnection(host, timeout=5) 149 h.request('POST', selector, body, {'content-type': content_type}) 150 h.getresponse() 160 151 except socket.timeout: 152 Logger.get('cdsconv').exception("Timeout connecting to %s" % host) 161 153 break 162 154 except Exception: 163 #writeLog(e) 164 pass 155 Logger.get('cdsconv').exception("Error connecting to %s" % host) 165 156 if lastseg == 1 : 166 157 #print "\n%s\n"%(h.getfile().read())
Note: See TracChangeset
for help on using the changeset viewer.
