コード例 #1
0
def fetch(list_ids): 
    dhnio.Dprint(6, "identitypropagate.fetch identities for %d users" % len(list_ids))
    dl = []
    for url in list_ids:
        if url:
            if not identitycache.FromCache(url):
                dl.append(identitycache.scheduleForCaching(url))
    return DeferredList(dl, consumeErrors=True)
コード例 #2
0
ファイル: message.py プロジェクト: vesellov/datahaven
def SendMessage(RemoteID, messagebody, PacketID=""):
    dhnio.Dprint(6, "message.SendMessage to: " + str(RemoteID))
    # TODO ERROR HERE (return Defer)
    if not identitycache.scheduleForCaching(RemoteID):
        dhnio.Dprint(1, "message.SendMessage ERROR. Can't find identity: " + str(RemoteID))
        return
    RemoteIdentity = identitycache.FromCache(RemoteID)
    if RemoteIdentity == "":
        dhnio.Dprint(1, "message.SendMessage ERROR. Can't retreive identity: " + str(RemoteID))
        return
    Amessage = MessageClass(RemoteIdentity, messagebody)
    MyID = misc.getLocalID()
    if PacketID == "":
        PacketID = packetid.UniqueID()
    Payload = misc.ObjectToString(Amessage)
    dhnio.Dprint(6, "message.SendMessage  about to send to " + RemoteID)
    result = dhnpacket.dhnpacket(commands.Message(), MyID, MyID, PacketID, Payload, RemoteID)
    transport_control.outboxAck(result)
コード例 #3
0
def FetchSingle(idurl):
    dhnio.Dprint(6, "identitypropagate.fetch_single " + idurl)
    return identitycache.scheduleForCaching(idurl)