<div class="gmail_quote">On 2 July 2010 20:42, Sascha Silbe <span dir="ltr">&lt;<a href="mailto:sascha-ml-ui-sugar-devel@silbe.org">sascha-ml-ui-sugar-devel@silbe.org</a>&gt;</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&#39;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(&#39;Registration: cannot connect to server&#39;)</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">         raise RegisterError(_(&#39;Cannot connect to the server.&#39;))</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(&#39;Registration: failed, check connectivity.&#39;)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">+        raise RegisterError(_(&#39;Please try connecting to the network&#39;))</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">     if data[&#39;success&#39;] != &#39;OK&#39;:</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">         logging.error(&#39;Registration: server could not complete request: %s&#39;,</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">                       data[&#39;error&#39;])</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>