Exemple #1
0
    def render(self, req):
        room_id = req.args.get('room_id', [''])[0]
        if room_id == '':
            return Room.all().addCallback(lambda rooms: RoomLister(rooms))

        args = map(lambda x: req.args.get(x, [''])[0], ['query', 'startdate', 'enddate']) + [room_id]
        def handleMsgs(msgs):
            return Room.find(room_id).addCallback(lambda room: MessageLister(msgs, room, *args))
        return Message.doSearch(*args).addCallback(handleMsgs)
Exemple #2
0
 def handleMsgs(msgs):
     return Room.find(room_id).addCallback(lambda room: MessageLister(msgs, room, *args))
Exemple #3
0
 def addRooms(r):
     room = r.pop()
     d = Room.createIfNonexistant(room[0], room[1]).addCallback(setID)
     if len(r) > 0:
         return d.addCallback(lambda _: addRooms(r))
     return d