Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@sugarlabs.org>2011-05-27 13:45:42 (GMT)
committer Gonzalo Odiard <godiard@sugarlabs.org>2011-05-27 13:45:42 (GMT)
commit1ee3977e1c54a791050e69b2622b42e02cda8698 (patch)
tree137c877ff018978d7807ec3018154a0aa0d79bfa
parentfd1c1a7fcf6170b0eb33742a0bf6b6f979d53770 (diff)
Fix interactions between the server and client side in collaboration
The client tried to open the comminicartion with the own server There are another problem in sugar-toolkit that inhibit collaboration #10906
-rw-r--r--readactivity.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/readactivity.py b/readactivity.py
index 4f4a7ee..926dbf3 100644
--- a/readactivity.py
+++ b/readactivity.py
@@ -699,8 +699,8 @@ class ReadActivity(activity.Activity):
_logger.debug("Got document %s (%s) from tube %u",
tempfile, suggested_name, tube_id)
- self._load_document("file://%s" % tempfile)
self.save()
+ self._load_document("file://%s" % tempfile)
def _download_progress_cb(self, getter, bytes_downloaded, tube_id):
# FIXME: Draw a progress bar
@@ -787,6 +787,9 @@ class ReadActivity(activity.Activity):
filepath -- string starting with file://
"""
+ filename = filepath.replace('file://', '')
+ if not os.path.exists(filename) or os.path.getsize(filename) == 0:
+ return
mimetype = mime.get_for_file(filepath)
if mimetype == 'application/epub+zip':
self._view = epubadapter.EpubViewer()
@@ -871,7 +874,7 @@ class ReadActivity(activity.Activity):
_logger.debug('New tube: ID=%d initator=%d type=%d service=%s '
'params=%r state=%d', tube_id, initiator, tube_type,
service, params, state)
- if self._document is None and service == READ_STREAM_SERVICE:
+ if self._view is None and service == READ_STREAM_SERVICE:
_logger.debug('I could download from that tube')
self.unused_download_tubes.add(tube_id)
# if no download is in progress, let's fetch the document