commit 8cc19def74521b38b9bb12cbfc36644ad0aeb9a2
Author: Frederick Grose <fgrose@sugarlabs.org>
Date: Fri Nov 15 22:11:02 2013 -0500
Save temporary .zip files in a user writable directory for alternate
installations as well.
Using activity.get_activity_root() instead of .get_bundle_path() for the
temporary storage directory enables SoaS and Fedora installations (in
/usr/share/sugar/activities/Log.activity) to save the log-nnnnnnnnnn.zip
without permissions problems. Fixes bugs.sugarlabs.org #4407.
diff --git a/logviewer.py b/logviewer.py
index 1f9bea0..91240b4 100644
a
|
b
|
class CollectorPalette(Palette): |
637 | 637 | def _on_send_button_clicked_cb(self, button): |
638 | 638 | identifier = str(int(time.time())) |
639 | 639 | filename = '%s.zip' % identifier |
| 640 | filepath = os.path.join(activity.get_activity_root(), filename) |
640 | 641 | success = True |
641 | 642 | try: |
642 | | filename = self._collector.write_logs(archive=filename, logbytes=0) |
| 643 | filename = self._collector.write_logs(archive=filepath, logbytes=0) |
643 | 644 | except: |
644 | 645 | success = False |
645 | 646 | |
| 647 | filename = os.path.basename(filename) |
646 | 648 | self.popdown(True) |
647 | 649 | |
648 | 650 | if not success: |
… |
… |
class CollectorPalette(Palette): |
664 | 666 | } |
665 | 667 | for k, v in metadata.items(): |
666 | 668 | jobject.metadata[k] = v |
667 | | jobject.file_path = os.path.join(activity.get_bundle_path(), filename) |
| 669 | jobject.file_path = filepath |
668 | 670 | datastore.write(jobject) |
669 | 671 | self._last_log = jobject.object_id |
670 | 672 | jobject.destroy() |
671 | 673 | activity.show_object_in_journal(self._last_log) |
672 | | os.remove(filename) |
| 674 | os.remove(filepath) |