[Sugar-devel] [PATCH] fixes sl#2062

Tim McNamara paperless at timmcnamara.co.nz
Fri Jul 2 05:36:24 EDT 2010


On 2 July 2010 20:42, Sascha Silbe <sascha-ml-ui-sugar-devel at silbe.org>wrote:

> Excerpts from Tim McNamara's message of Fri Jul 02 02:09:17 +0000 2010:
>

[old patch]

>
> TypeError should be catched in
> jarabe.desktop.schoolserver.register_laptop()
> and rethrown as a RegisterError.
>
> Sascha
>



Subject: [PATCH] schoolserver.register_laptop() complains when offline

register_laptop() now raises the TypeError raised by
xmlrpclib as a RegisterError. This also provides visual
feedback to the user, prompting to connect to the network.
---
 src/jarabe/desktop/schoolserver.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/jarabe/desktop/schoolserver.py
b/src/jarabe/desktop/schoolserver.py
index fc9ddeb..9e46d50 100644
--- a/src/jarabe/desktop/schoolserver.py
+++ b/src/jarabe/desktop/schoolserver.py
@@ -102,7 +102,10 @@ def register_laptop(url=REGISTER_URL):
     except (Error, socket.error):
         logging.exception('Registration: cannot connect to server')
         raise RegisterError(_('Cannot connect to the server.'))
-
+    except ImportError:
+        #raised by xmlrpclib
+        logging.exception('Registration: failed, check connectivity.')
+        raise RegisterError(_('Please try connecting to the network'))
     if data['success'] != 'OK':
         logging.error('Registration: server could not complete request:
%s',
                       data['error'])
-- 
1.7.0.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100702/57682256/attachment.htm 


More information about the Sugar-devel mailing list