Il 07/04/2011 16:06, garulf ha scritto:
> Salve ciot*,
...
..
...
piccola patch (di gia' :D)
_______________________________________________
Ciotoflow mailing list
Ciotoflow@???
https://www.autistici.org/mailman/listinfo/ciotoflow
--- ../server.py 2011-04-07 16:10:42.000000000 +0200
+++ server.py 2011-04-07 17:26:24.000000000 +0200
@@ -48,14 +48,16 @@
environ = kw['environ']
else:
environ = args[3]
-
+
+ self.created = False
self.asd_session = environ['SESSION']
self.asd_length = int (environ['CONTENT_LENGTH'])
cgi.FieldStorage.__init__ (self, *args, **kw)
def make_file (self, binary=None):
- self.filename = str (time.time()).replace ('.','')+'-'+selfc.filename
+ self.filename = str (time.time()).replace ('.','')+'-'+self.filename
+ self.created = True
return AsdIO (self.filename, self.asd_session, self.asd_length)
@@ -145,8 +147,8 @@
form_parser = AsdFieldStorage (fp=self.rfile, environ=environ)
#checking if cgi.make_file is called (isn't called for file < 1000 bytes)
- dpath = os.path.join (down_dir, form_parser['file'].filename)
- if not os.path.isfile (dpath):
+ if not form_parser['file'].created:
+ dpath = os.path.join (down_dir, str(time.time()).replace('.','')+'-'+form_parser['file'].filename)
dfile = open (dpath, 'w')
shutil.copyfileobj (form_parser['file'].file, dfile)
dfile.close ()