diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2013-02-28 20:48:56 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2013-02-28 21:01:16 (GMT) |
commit | 36a73c04fd100aae1a533099f771d8469060c33d (patch) | |
tree | 1e041ef31cb2aba61b13fa849268f6b01f99304a /readactivity.py | |
parent | 98dd714497d861f0ac2e224c214f54ebfcd355c3 (diff) |
Calculate the md5 at write when a file is received - SL #4448
When a file is received after joining a colaboration session,
need be saved in the journal, and we need calculate the md5 hash.
Signed-off-by: Gonzalo Odiard <gonzalo@laptop.org>
Diffstat (limited to 'readactivity.py')
-rw-r--r-- | readactivity.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/readactivity.py b/readactivity.py index 1481056..c7a81aa 100644 --- a/readactivity.py +++ b/readactivity.py @@ -144,6 +144,7 @@ class ReadActivity(activity.Activity): self._fileserver = None self._object_id = handle.object_id self._toc_model = None + self.filehash = None self.connect('key-press-event', self._key_press_event_cb) self.connect('key-release-event', self._key_release_event_cb) @@ -724,9 +725,11 @@ class ReadActivity(activity.Activity): self.metadata['Read_search'] = \ self._edit_toolbar._search_entry.props.text self.metadata['activity'] = self.get_bundle_id() - self.metadata['filehash'] = self.filehash os.link(self._tempfile, file_path) + if self.filehash is None: + self.filehash = get_md5(file_path) + self.metadata['filehash'] = self.filehash if self._close_requested: _logger.debug("Removing temp file %s because we will close", |