--- cdli/tools/uploadATF.py 2011/07/19 12:43:26 1.1 +++ cdli/tools/uploadATF.py 2011/07/20 09:33:34 1.2 @@ -15,6 +15,8 @@ from Products.cdli.cdli_files import CDL import pickle class StoreObject: + + returnValue={} def __init__(self,storeId): self.storeId= storeId @@ -29,6 +31,8 @@ class StoreObject: class uploadATFThread: """class for checking the files befor uploading""" + DEBUG=True + def checkFile(self,filename,data,folder): """check the files""" # first check the file name @@ -56,8 +60,8 @@ class uploadATFThread: iter=fh.readlines() for lineTmp in iter: - #if fileCount>10: - # break; + if (self.DEBUG==True) and (fileCount>10): + break; lineTmp=lineTmp.replace(codecs.BOM_UTF8,'') # make sure that all BOM are removed.. for line in lineTmp.split("\r"): #logging.info("Deal with: %s"%line) @@ -80,8 +84,8 @@ class uploadATFThread: fileCount+=1 print fileCount nf.close() #close file - #if fileCount>10: - # break + if (self.DEBUG==True) and (fileCount>10): + break filename=line[1:].split("=")[0].rstrip()+".atf" if dir: @@ -111,7 +115,7 @@ class uploadATFThread: logging.getLogger().setLevel(logging.DEBUG) - def set(self,uploadId,basketId,username,serverport="8080"): + def set(self,uploadId,basketId,username,serverport="29080"): """set start values for the thread""" self.result=file("/tmp/"+str(uploadId)+".out","w") self.uploadId=uploadId @@ -306,6 +310,14 @@ def checkUTF8(data): return False if __name__ == "__main__": + if len(sys.argv)<5: + print """Usage: procedure uploadId comment basketName unlock username + uploadId: Ticket ID von uploadATF + basketName: name of the basket + username: username + port of a running zope (not the zeo) + """ + upload = uploadATFThread() x=sys.argv; print x