예제 #1
0
def test_event_clone():

    a = Event({"one": 1, "two": 2})
    b = a.clone()

    assert id(a.data) != id(b.data)
    assert not a.data["cloned"]
    assert b.data["cloned"]
    assert b.data["uuid_previous"][0] == a.data["uuid"]
    def handleMessage(self, message):

        e = Event("\n".join(message.arguments))
        e.set(message.type, '@tmp.%s.type' % (self.name))
        e.set(message.source, '@tmp.%s.source' % (self.name))

        if message.type == "pubmsg":
            e.set(message.target, '@tmp.%s.channel' % (self.name))
            self.submit(e, getattr(self.pool.queue, message.target.strip('#').lower()))
        elif message.type == "privmsg":
            self.submit(e, getattr(self.pool.queue, "priv__%s" % (self.kwargs.nickname)))

        self.submit(e.clone(), self.pool.queue.outbox)