[Sugar-devel] [PATCH sugar] Register with schoolserver: adopt to changes in xmlrpclib for python 2.7 OLPC #10776
Simon Schampijer
simon at schampijer.de
Tue Jun 7 05:49:48 EDT 2011
Tested-by: Samuel Greenfeld <greenfeld at laptop.org>
see: http://dev.laptop.org/ticket/10776
On 05/31/2011 07:03 PM, Simon Schampijer wrote:
> Python 2.7 switched from using httplib.HTTP to using httplib.HTTPConnection,
> as the httplib.HTTPConnection includes a timeout by default we can use a
> xmlrpclib.Transport directly and do not need to subclass it.
>
> Signed-off-by: Simon Schampijer<simon at laptop.org>
> ---
> src/jarabe/desktop/schoolserver.py | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/src/jarabe/desktop/schoolserver.py b/src/jarabe/desktop/schoolserver.py
> index aea2357..9491fdf 100644
> --- a/src/jarabe/desktop/schoolserver.py
> +++ b/src/jarabe/desktop/schoolserver.py
> @@ -24,6 +24,7 @@ from string import ascii_uppercase
> import random
> import time
> import uuid
> +import sys
>
> import gconf
>
> @@ -123,7 +124,11 @@ def register_laptop(url=_REGISTER_URL):
>
> nick = client.get_string('/desktop/sugar/user/nick')
>
> - server = xmlrpclib.ServerProxy(url, _TimeoutTransport())
> + if sys.hexversion< 0x2070000:
> + server = xmlrpclib.ServerProxy(url, _TimeoutTransport())
> + else:
> + socket.setdefaulttimeout(_REGISTER_TIMEOUT)
> + server = xmlrpclib.ServerProxy(url)
> try:
> data = server.register(sn, nick, uuid_, profile.pubkey)
> except (xmlrpclib.Error, TypeError, socket.error):
More information about the Sugar-devel
mailing list