Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucian Branescu Mihaila <lucian.branescu@gmail.com>2010-07-15 01:33:14 (GMT)
committer Lucian Branescu Mihaila <lucian.branescu@gmail.com>2010-07-15 01:33:14 (GMT)
commit90fbefd203b83aa51b2d1e1e3016e67b34160e4d (patch)
tree1fd0767e3ee02da3ea99bcf31fb03d2c446ff397
parent91a20df09f78d6a0fadb395ca4f6e5ff6efef079 (diff)
Complete monkeypatched WebKitDownloadStatus enum. Clarifications.
-rw-r--r--downloadmanager.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/downloadmanager.py b/downloadmanager.py
index 6f5aa05..28260bf 100644
--- a/downloadmanager.py
+++ b/downloadmanager.py
@@ -53,9 +53,11 @@ _active_downloads = []
_dest_to_window = {}
-# HACK: pywebkitgtk is missing the WebKitDownloadStatus
+# HACK: pywebkitgtk is missing the WebKitDownloadStatus enum
webkit.WebKitDownloadStatus = type(webkit.Download().get_status())
+webkit.DOWNLOAD_STATUS_ERROR = webkit.WebKitDownloadStatus(-1)
+webkit.DOWNLOAD_STATUS_CREATED = webkit.WebKitDownloadStatus(0)
webkit.DOWNLOAD_STATUS_STARTED = webkit.WebKitDownloadStatus(1)
webkit.DOWNLOAD_STATUS_FINISHED = webkit.WebKitDownloadStatus(3)
webkit.DOWNLOAD_STATUS_CANCELLED = webkit.WebKitDownloadStatus(2)
@@ -145,6 +147,7 @@ class UserDownload(object):
#if self._mime_type in ['application/octet-stream',
# 'application/x-zip']:
+ # sniff for a mime type, no way to get headers from pywebkitgtk
sniffed_mime_type = mime.get_for_file(self._dest_uri)
self.dl_jobject.metadata['mime_type'] = sniffed_mime_type
@@ -203,11 +206,11 @@ class UserDownload(object):
def _get_file_name(self):
src = urlparse.urlparse(self._source)
-
+
if src.scheme == 'data':
return 'Data URI'
else:
- return self._download.get_suggested_filename()
+ return self._download.get_suggested_filename()
def _create_journal_object(self):
self.dl_jobject = datastore.create()