Don't set path in the downloader
Gonzalo Odiard
10 years ago
842 | 842 | self._progress_alert = None |
843 | 843 | GObject.idle_add(self._get_document) |
844 | 844 | |
845 | def _download_document(self, tube_id, path): | |
845 | def _download_document(self, tube_id): | |
846 | 846 | # FIXME: should ideally have the CM listen on a Unix socket |
847 | 847 | # instead of IPv4 (might be more compatible with Rainbow) |
848 | 848 | chan = self.shared_activity.telepathy_tubes_chan |
866 | 866 | getter.connect("finished", self._download_result_cb, tube_id) |
867 | 867 | getter.connect("progress", self._download_progress_cb, tube_id) |
868 | 868 | getter.connect("error", self._download_error_cb, tube_id) |
869 | _logger.debug("Starting download to %s...", path) | |
870 | getter.start(path) | |
869 | getter.start() | |
871 | 870 | self._download_content_length = getter.get_content_length() |
872 | 871 | self._download_content_type = getter.get_content_type() |
873 | 872 | return False |
875 | 874 | def _get_document(self): |
876 | 875 | if not self._want_document: |
877 | 876 | return False |
878 | ||
879 | # Assign a file path to download if one doesn't exist yet | |
880 | if not self._jobject.file_path: | |
881 | path = os.path.join(self.get_activity_root(), 'instance', | |
882 | 'tmp%i' % time.time()) | |
883 | else: | |
884 | path = self._jobject.file_path | |
885 | 877 | |
886 | 878 | # Pick an arbitrary tube we can try to download the document from |
887 | 879 | try: |
893 | 885 | |
894 | 886 | # Avoid trying to download the document multiple times at once |
895 | 887 | self._want_document = False |
896 | GObject.idle_add(self._download_document, tube_id, path) | |
888 | GObject.idle_add(self._download_document, tube_id) | |
897 | 889 | return False |
898 | 890 | |
899 | 891 | def _joined_cb(self, also_self): |