Ticket #1151: schoolserver.patch

File schoolserver.patch, 868 bytes (added by dsd, 15 years ago)

patch against sugar's hardware/schoolserver.py

  • schoolserver.py

    old new  
    33from xmlrpclib import ServerProxy, Error
    44import socket
    55import os
     6import dbus
    67
    78from sugar.profile import get_profile
    89
    910REGISTER_URL = 'http://schoolserver:8080/'
     11_PS_PATH = '/org/laptop/Sugar/Presence'
     12_PS_IFACE = 'org.laptop.Sugar.Presence'
    1013
    1114class RegisterError(Exception):
    1215    pass
     
    3942    profile.backup1 = data['backupurl']
    4043    profile.save()
    4144
     45    # ask Sugar to connect to the new school server
     46    try:
     47        retry_connections()
     48    except:
     49        pass
     50
    4251    return True
    4352
     53def retry_connections():
     54    obj = dbus.SessionBus().get_object(_PS_IFACE, _PS_PATH)
     55    ps = dbus.Interface(obj, _PS_IFACE)
     56    ps.RetryConnections()
     57
    4458def have_ofw_tree():
    4559    return os.path.exists('/ofw')
    4660