[Sugar-devel] [PATCH sugar] Register with schoolserver: adopt to changes in xmlrpclib for python 2.7 OLPC #10776
Simon Schampijer
simon at schampijer.de
Thu May 19 10:08:36 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.
---
src/jarabe/desktop/schoolserver.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/src/jarabe/desktop/schoolserver.py b/src/jarabe/desktop/schoolserver.py
index aea2357..a68f3e2 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,10 @@ def register_laptop(url=_REGISTER_URL):
nick = client.get_string('/desktop/sugar/user/nick')
- server = xmlrpclib.ServerProxy(url, _TimeoutTransport())
+ if sys.version_info[1] < 7:
+ server = xmlrpclib.ServerProxy(url, _TimeoutTransport())
+ else:
+ server = xmlrpclib.ServerProxy(url, xmlrpclib.Transport())
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