Ejemplo n.º 1
0
 def publishEvent(self, eventname, syncertoken, *args, **kw):
     syncer = Pyro.core.getProxyForURI(self.syncer_uri)
     args = [cPickle.dumps(arg, -1) for arg in args]
     kw = dict(((cPickle.dumps(k, -1), cPickle.dumps(v, -1)) for (k,v) in kw.items()))
     try:
         return getattr(syncer, eventname)(self.appname, self.getSyncerToken(), *args, **kw)
     except Pyro.errors.ProtocolError:
         return errors.getClientError(errors.syncer_conn_failed)
     except Exception, err:
         return err
Ejemplo n.º 2
0
    def __init__(self, appname, sessiongetter,client_disabled=-1,syncer_uri=-1):

        if client_disabled == -1:
            client_disabled=config.client_disabled
        if syncer_uri == -1:
            syncer_uri=config.syncer_uri
        self.appname = appname
        self.sessiongetter = sessiongetter
        self.syncer_uri = syncer_uri 
        if client_disabled:
            self.publishEvent = lambda *args, **kw: errors.getClientError(errors.syncer_client_disabled)
        else:
            print "SyncerClient initialized for %s:%s -> %s" % (config.host, config.port, config.ldap_uri)