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

2010-07-03 Thread Tim McNamara
On 2 July 2010 20:42, Sascha Silbe sascha-ml-ui-sugar-de...@silbe.orgwrote:

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

 Sascha


diff --git a/src/jarabe/desktop/schoolserver.py
b/src/jarabe/desktop/schoolserver.py
index fc9ddeb..a05f56c 100644
--- a/src/jarabe/desktop/schoolserver.py
+++ b/src/jarabe/desktop/schoolserver.py
@@ -99,7 +99,7 @@ def register_laptop(url=REGISTER_URL):
 server = ServerProxy(url)
 try:
 data = server.register(sn, nick, uuid_, profile.pubkey)
-except (Error, socket.error):
+except (Error, TypeError, socket.error):
 logging.exception('Registration: cannot connect to server')
 raise RegisterError(_('Cannot connect to the server.'))
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2010-07-03 Thread Sascha Silbe
Excerpts from Tim McNamara's message of Sat Jul 03 11:49:50 + 2010:

 diff --git a/src/jarabe/desktop/schoolserver.py
 b/src/jarabe/desktop/schoolserver.py
 index fc9ddeb..a05f56c 100644
 --- a/src/jarabe/desktop/schoolserver.py
 +++ b/src/jarabe/desktop/schoolserver.py
 @@ -99,7 +99,7 @@ def register_laptop(url=REGISTER_URL):
  server = ServerProxy(url)
  try:
  data = server.register(sn, nick, uuid_, profile.pubkey)
 -except (Error, socket.error):
 +except (Error, TypeError, socket.error):
  logging.exception('Registration: cannot connect to server')
  raise RegisterError(_('Cannot connect to the server.'))

Reviewed-By: Sascha Silbe sascha-...@silbe.org

Thanks!

Sascha


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2010-07-03 Thread Bernie Innocenti
El Sat, 03-07-2010 a las 12:41 +, Sascha Silbe escribió:
 Excerpts from Tim McNamara's message of Sat Jul 03 11:49:50 + 2010:
 
  diff --git a/src/jarabe/desktop/schoolserver.py
  b/src/jarabe/desktop/schoolserver.py
  index fc9ddeb..a05f56c 100644
  --- a/src/jarabe/desktop/schoolserver.py
  +++ b/src/jarabe/desktop/schoolserver.py
  @@ -99,7 +99,7 @@ def register_laptop(url=REGISTER_URL):
   server = ServerProxy(url)
   try:
   data = server.register(sn, nick, uuid_, profile.pubkey)
  -except (Error, socket.error):
  +except (Error, TypeError, socket.error):
   logging.exception('Registration: cannot connect to server')
   raise RegisterError(_('Cannot connect to the server.'))
 
 Reviewed-By: Sascha Silbe sascha-...@silbe.org

Tim, thank you very much for fixing this. I would like to include your
fix in my Sugar 0.88 packages. Could you please repost the complete
patch with this amendment included? (git commit --amend makes it easy)

Also, could you look into these related bugs?

 http://bugs.sugarlabs.org/ticket/1940
 http://bugs.sugarlabs.org/ticket/1977
 http://bugs.sugarlabs.org/ticket/1976

I'm trying to spread idea of letting children and teachers upgrade their
laptops without relying on technicians to do it. To lower the barrier,
it's important to make the Register procedure free of quirks.

-- 
   // Bernie Innocenti - http://codewiz.org/
 \X/  Sugar Labs   - http://sugarlabs.org/

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2010-07-03 Thread Sascha Silbe
Excerpts from Bernie Innocenti's message of Sat Jul 03 13:32:44 + 2010:
   -except (Error, socket.error):
   +except (Error, TypeError, socket.error):
 Tim, thank you very much for fixing this. I would like to include your
 fix in my Sugar 0.88 packages. Could you please repost the complete
 patch with this amendment included? (git commit --amend makes it easy)
This _is_ the complete patch. :D

FTR, this was my reasoning for amending the existing except block instead
of adding a new one:

2010-07-02 13:53:27  silbe timClicks: to me it's always just a failure to 
connect to the server. I'm not sure TypeError always implies lack of a network 
connection and other errors imply there's a network connection (but a different 
error occured), so I'd just always present the same message (and maybe change 
it to hint at establishing a network connection). But since you might know 
better I thought I'd ask first.

Sascha


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2010-07-02 Thread Sascha Silbe
Excerpts from Tim McNamara's message of Fri Jul 02 02:09:17 + 2010:
 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 ' \

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

Sascha

--
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2010-07-01 Thread Tim McNamara
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 323323except RegisterError, e:  324324
alert.props.title = _('Registration Failed')  325325
alert.props.msg = _('%s') % e326except TypeError:   327
  # raised by xmlrpclib.py when XO attempts to   328# register
itelf while offline: sl#2062   329alert.props.title =
_('Registration Failed')   330alert.props.msg = _('Please try
connecting to '\   331 'the network.')   326
332else:  327333alert.props.title = _('Registration
Successful')  328334alert.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 ' \
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2010-07-01 Thread James Cameron
On Fri, Jul 02, 2010 at 02:09:17PM +1200, Tim McNamara wrote:
 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.

Trivial typo in second line of comment.  s/itelf/itself

Otherwise fine.

Reviewed-by: James Cameron qu...@laptop.org

-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel