Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Lewis <jtl1728@rit.edu>2010-01-12 22:13:24 (GMT)
committer Justin Lewis <jtl1728@rit.edu>2010-01-12 22:13:24 (GMT)
commit2e9cf804382522ce785438c075bc699c32a7fb89 (patch)
treee8787cca5989aaeac6ffdf9d94c2080a794c52d5
parent494db1554b59a43c1e886fa4eca1da73dc6372b2 (diff)
Fixed Keep Error bug
-rw-r--r--FileShare.activity/FileShareActivity.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/FileShare.activity/FileShareActivity.py b/FileShare.activity/FileShareActivity.py
index 68bbb6f..de2ae7f 100644
--- a/FileShare.activity/FileShareActivity.py
+++ b/FileShare.activity/FileShareActivity.py
@@ -564,8 +564,13 @@ class FileShareActivity(Activity):
def write_file(self, file_path):
_logger.debug('Writing activity file')
- # If no files to save, nothing to do
+ file = zipfile.ZipFile(file_path, "w")
+
+ # If no files to save save empty list
if len(self.sharedFiles) == 0:
+ #hack to empty file if existed before
+ file.writestr("_filelist.json", simplejson.dumps({}))
+ file.close()
return
if self._close_requested:
@@ -580,14 +585,11 @@ class FileShareActivity(Activity):
# Return not allowing files to be saved
if response == gtk.RESPONSE_NO:
#hack to empty file if existed before
- file = zipfile.ZipFile(file_path, "w")
file.writestr("_filelist.json", simplejson.dumps({}))
file.close()
return
- # Create zip of tmp directory
- file = zipfile.ZipFile(file_path, "w")
-
+ # Save, requested, write files into zip and save file list
try:
for name in os.listdir(self._filepath):
file.write(os.path.join( self._filepath, name), name, zipfile.ZIP_DEFLATED)