From 8a9bc3b702673a60b44b60860e52f57767b36ddd Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sat, 01 Sep 2007 09:59:41 +0000 Subject: Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar --- (limited to 'sugar') diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 3691a5e..21a9771 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -123,7 +123,7 @@ class ActivityToolbar(gtk.Toolbar): self._activity.share(private=True) def _keep_clicked_cb(self, button): - self._activity.save() + self._activity.copy() def _stop_clicked_cb(self, button): self._activity.close() @@ -305,7 +305,7 @@ class Activity(Window, gtk.Container): elif scope == SHARE_NEIGHBORHOOD: self.share(private=False) else: - logging.debug("Unknown share scope %d" % scope) + logging.debug("Unknown share scope %r" % scope) except KeyError: pass elif create_jobject: @@ -455,6 +455,8 @@ class Activity(Window, gtk.Container): def save(self): """Request that the activity is saved to the Journal.""" + logging.debug('Activity.save: %r' % self._jobject.object_id) + if self._updating_jobject: return @@ -483,6 +485,11 @@ class Activity(Window, gtk.Container): reply_handler=self._internal_save_cb, error_handler=self._internal_save_error_cb) + def copy(self): + logging.debug('Activity.copy: %r' % self._jobject.object_id) + self.save() + self._jobject.object_id = None + def _internal_joined_cb(self, activity, success, err): """Callback when join has finished""" self._shared_activity.disconnect(self._join_id) diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py index d361c62..8bf3386 100644 --- a/sugar/activity/bundle.py +++ b/sugar/activity/bundle.py @@ -219,11 +219,9 @@ class Bundle: file_names = zip_file.namelist() root_dir = self._get_bundle_root_dir(file_names) icon_path = os.path.join(root_dir, 'activity', self._icon + '.svg') - print icon_path - print file_names if icon_path in file_names: icon_data = zip_file.read(icon_path) - temp_file, temp_file_path = tempfile.mkstemp(self._icon) + temp_file, temp_file_path = tempfile.mkstemp(suffix='.svg', prefix=self._icon) os.write(temp_file, icon_data) os.close(temp_file) return temp_file_path diff --git a/sugar/network.py b/sugar/network.py index 77de95e..49d4882 100644 --- a/sugar/network.py +++ b/sugar/network.py @@ -144,6 +144,10 @@ class ChunkedGlibHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): ** [dcbw] modified to send Content-disposition filename too """ path = self.translate_path(self.path) + if not path or not os.path.exists(path): + self.send_error(404, "File not found") + return None + f = None if os.path.isdir(path): for index in "index.html", "index.htm": -- cgit v0.9.1