Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/olpc/datastore/filestore.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/olpc/datastore/filestore.py b/src/olpc/datastore/filestore.py
index c7dd936..0ed2b56 100644
--- a/src/olpc/datastore/filestore.py
+++ b/src/olpc/datastore/filestore.py
@@ -100,8 +100,10 @@ class FileStore(object):
attempt = 1
while os.path.exists(destination_path):
if attempt > 10:
- destination_path = tempfile.mkstemp(prefix=uid,
- dir=destination_dir)
+ fd, destination_path = tempfile.mkstemp(prefix=uid,
+ dir=destination_dir)
+ del fd
+ break
else:
file_name = '%s_%s' % (uid, attempt)
destination_path = os.path.join(destination_dir, file_name)