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

Tim McNamara paperless at timmcnamara.co.nz
Thu Jul 1 22:09:17 EDT 2010


Hi all

ref http://bugs.sugarlabs.org/ticket/2062

Simple fix, have captured the exception that's raised and have told user to
connect to the nework:

This commit fixes sl#2062. This bug causes XS registrations
to fail silently when the XO is offline. The fix is to
catch the TypeError & provide an alert to the user upon
failure.
---
 src/jarabe/desktop/favoritesview.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/jarabe/desktop/favoritesview.py
b/src/jarabe/desktop/favoritesview.py
index aca945a..45fa305 100644

   a  b     323323        except RegisterError, e:  324324
alert.props.title = _('Registration Failed')  325325
alert.props.msg = _('%s') % e    326        except TypeError:   327
  # raised by xmlrpclib.py when XO attempts to   328            # register
itelf while offline: sl#2062   329            alert.props.title =
_('Registration Failed')   330            alert.props.msg = _('Please try
connecting to '\   331                                 'the network.')   326
332        else:  327333            alert.props.title = _('Registration
Successful')  328334            alert.props.msg = _('You are now registered
' \

Index: src/jarabe/desktop/favoritesview.py
===================================================================
--- a/src/jarabe/desktop/favoritesview.py
+++ b/src/jarabe/desktop/favoritesview.py
@@ -323,6 +323,12 @@
         except RegisterError, e:
             alert.props.title = _('Registration Failed')
             alert.props.msg = _('%s') % e
+        except TypeError:
+            # raised by xmlrpclib.py when XO attempts to
+            # register itelf while offline: sl#2062
+            alert.props.title = _('Registration Failed')
+            alert.props.msg = _('Please try connecting to '\
+                                 'the network.')
         else:
             alert.props.title = _('Registration Successful')
             alert.props.msg = _('You are now registered ' \
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.sugarlabs.org/archive/sugar-devel/attachments/20100702/810a4411/attachment.htm 


More information about the Sugar-devel mailing list