[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 May 31 13:03:30 EDT 2011
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):
--
1.7.4
More information about the Sugar-devel
mailing list