Beispiel #1
0
    def get(self):
        participation = self.current_user

        last_notification = self.get_argument("last_notification", None)
        if last_notification is not None:
            last_notification = make_datetime(float(last_notification))

        res = get_communications(self.sql_session,
                                 participation,
                                 self.timestamp,
                                 after=last_notification)

        # Simple notifications
        notifications = self.service.notifications
        username = participation.user.username
        if username in notifications:
            for notification in notifications[username]:
                res.append({
                    "type": "notification",
                    "timestamp": make_timestamp(notification[0]),
                    "subject": notification[1],
                    "text": notification[2],
                    "level": notification[3]
                })
            del notifications[username]

        self.write(json.dumps(res))
Beispiel #2
0
    def get(self):
        participation = self.current_user

        last_notification = self.get_argument("last_notification", None)
        if last_notification is not None:
            last_notification = make_datetime(float(last_notification))

        res = get_communications(self.sql_session, participation,
                                 self.timestamp, after=last_notification)

        # Simple notifications
        notifications = self.service.notifications
        username = participation.user.username
        if username in notifications:
            for notification in notifications[username]:
                res.append({"type": "notification",
                            "timestamp": make_timestamp(notification[0]),
                            "subject": notification[1],
                            "text": notification[2],
                            "level": notification[3]})
            del notifications[username]

        self.write(json.dumps(res))
Beispiel #3
0
 def call(self, timestamp, after=None):
     return get_communications(
         self.session,
         self.participation,
         self.at(timestamp),
         after=self.at(after) if after is not None else None)
Beispiel #4
0
 def call(self, timestamp, after=None):
     return get_communications(
         self.session, self.participation, self.at(timestamp),
         after=self.at(after) if after is not None else None)