def upload(self, request, response_head): try: seek_start = request.form.get("seek_start", None) filename = request.form.get("filename", None) data = request.filedic.get("data", None) if seek_start == None and filename != None: filepath = os.path.join(savedir, filename) cmd = "rm -rf %s; touch %s" % (filepath, filepath) os.popen(cmd).read() return "suc" elif data != None and filename != None and seek_start != None: filepath = os.path.join(savedir, filename) seek_start = int(seek_start) f = open(filepath, "r+") f.seek(seek_start) f.write(data.file.read()) f.close() return "suc" else: return "empty" except Exception, e: loger.log(str(e) + base.getTraceStackMsg()) return str(e) + base.getTraceStackMsg()
def upload(self, request, response_head): try: seek_start = request.form.get("seek_start", None) filename = request.form.get("filename", None) data = request.filedic.get("data", None) if seek_start == None and filename != None: filepath = os.path.join(savedir, filename) cmd = "rm -rf %s; touch %s" % (filepath, filepath) os.popen(cmd).read() return "suc" elif data != None and filename != None and seek_start != None: filepath = os.path.join(savedir, filename) seek_start = int(seek_start) f = open(filepath, "r+") f.seek(seek_start) f.write(data.file.read()) f.close() return "suc" else: return "empty" except Exception, e: loger.log(str(e)+base.getTraceStackMsg()) return str(e)+base.getTraceStackMsg()
def __init__(self): try: pass except Exception, e: print str(e) + base.getTraceStackMsg()
def __init__(self): try: pass except Exception, e: print str(e)+base.getTraceStackMsg()