gnome-lirc-properties r9 - in trunk: . gnome_lirc_properties/net
- From: murrayc svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-lirc-properties r9 - in trunk: . gnome_lirc_properties/net
- Date: Mon, 28 Apr 2008 06:18:41 +0100 (BST)
Author: murrayc
Date: Mon Apr 28 05:18:41 2008
New Revision: 9
URL: http://svn.gnome.org/viewvc/gnome-lirc-properties?rev=9&view=rev
Log:
2008-04-28 Murray Cumming <murrayc murrayc com>
* gnome_lirc_properties/net/services.py: post_file():
catch httplib.HTTPException as well as the existing urllib2 errors,
because multipart_opener.open() raises this exception. This fixes the
crash in bug #529903, but I still don't know how to make the upload work.
Modified:
trunk/ChangeLog
trunk/gnome_lirc_properties/net/services.py
Modified: trunk/gnome_lirc_properties/net/services.py
==============================================================================
--- trunk/gnome_lirc_properties/net/services.py (original)
+++ trunk/gnome_lirc_properties/net/services.py Mon Apr 28 05:18:41 2008
@@ -60,7 +60,7 @@
if isinstance(ex.reason, gaierror):
return ex.reason[1]
- return _('Cannot resolve host name')
+ return _('Cannot resolve host name.')
return getattr(ex, 'message', None)
@@ -112,7 +112,10 @@
finished_callback(extract_html_message(response) or
(_('Upload of %s succeeded.') % context))
- except (urllib2.HTTPError, urllib2.URLError), ex:
+ except (urllib2.HTTPError, urllib2.URLError, httplib.HTTPException), ex:
+ # Note: When this catches an httplib.BadStatusLine, the ex.message is empty:
+ print("debug: post_file() exception: %s\n" % ex.message)
+
if failure_callback:
error = NetworkError(_('Upload of %s failed') % context, ex)
failure_callback(error.message)
@@ -183,10 +186,10 @@
content, headers = self._retrieve(self.__checksum_uri)
except (urllib2.HTTPError, urllib2.URLError), ex:
- raise NetworkError(_('Cannot retrieve checksum list'), ex)
+ raise NetworkError(_('Cannot retrieve checksum list.'), ex)
if 'text/plain' != headers['content-type']:
- raise NetworkError(_('Cannot retrieve checksum list'),
+ raise NetworkError(_('Cannot retrieve checksum list.'),
_('Unexpected content type.'))
checksums = dict([
@@ -218,7 +221,7 @@
report(self.on_success, ex, ex.info())
except urllib2.URLError, ex:
- raise NetworkError(_('Cannot retrieve file archive'), ex)
+ raise NetworkError(_('Cannot retrieve file archive.'), ex)
return None, None
@@ -244,6 +247,9 @@
except NetworkError, ex:
report(self.on_failure, ex.message)
+ if ex.cause:
+ print("debug: NetworkError: %s\n", ex.cause.message)
+
return False
def _verify_checksum(self, content, headers):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]