<div class="gmail_quote">On 2 July 2010 20:42, Sascha Silbe <span dir="ltr"><<a href="mailto:sascha-ml-ui-sugar-devel@silbe.org">sascha-ml-ui-sugar-devel@silbe.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Excerpts from Tim McNamara's message of Fri Jul 02 02:09:17 +0000 2010:<br>
<div class="im"></div></blockquote><div><br>[old patch]</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im"><br>
</div>TypeError should be catched in jarabe.desktop.schoolserver.register_laptop()<br>
and rethrown as a RegisterError.<br>
<br>
Sascha<br></blockquote><div><br><br><br>Subject: [PATCH] schoolserver.register_laptop() complains when offline<br><br>register_laptop() now raises the TypeError raised by<br>xmlrpclib as a RegisterError. This also provides visual<br>
feedback to the user, prompting to connect to the network.<br><span style="font-family: courier new,monospace;">---</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> src/jarabe/desktop/schoolserver.py | 5 ++++-</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> 1 files changed, 4 insertions(+), 1 deletions(-)</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">diff --git a/src/jarabe/desktop/schoolserver.py b/src/jarabe/desktop/schoolserver.py</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">index fc9ddeb..9e46d50 100644</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">--- a/src/jarabe/desktop/schoolserver.py</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+++ b/src/jarabe/desktop/schoolserver.py</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">@@ -102,7 +102,10 @@ def register_laptop(url=REGISTER_URL):</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> except (Error, socket.error):</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> logging.exception('Registration: cannot connect to server')</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> raise RegisterError(_('Cannot connect to the server.'))</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ except ImportError:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ #raised by xmlrpclib</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">+ logging.exception('Registration: failed, check connectivity.')</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+ raise RegisterError(_('Please try connecting to the network'))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> if data['success'] != 'OK':</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> logging.error('Registration: server could not complete request: %s',</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> data['error'])</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">-- </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">1.7.0.4</span><br> </div></div>