Пример #1
0
    def notify(self, message = '', data = None, listener = None):
        if not data: data = {}

        try:
            db = get_session()

            data['notification_type'] = listener if listener else 'unknown'

            n = Notif(
                message = toUnicode(message),
                data = data
            )
            db.add(n)
            db.commit()

            ndict = n.to_dict()
            ndict['type'] = 'notification'
            ndict['time'] = time.time()

            self.frontend(type = listener, data = data)

            return True
        except:
            log.error('Failed notify: %s', traceback.format_exc())
            db.rollback()
        finally:
            db.close()
Пример #2
0
    def notify(self, message="", data={}, listener=None):

        db = get_session()

        data["notification_type"] = listener if listener else "unknown"

        n = Notif(message=toUnicode(message), data=data)
        db.add(n)
        db.commit()

        ndict = n.to_dict()
        ndict["type"] = "notification"
        ndict["time"] = time.time()
        self.messages.append(ndict)

        db.close()
        return True
Пример #3
0
    def notify(self, message = '', data = {}):

        db = get_session()

        n = Notif(
            message = toUnicode(message),
            data = data
        )
        db.add(n)
        db.commit()

        ndict = n.to_dict()
        ndict['type'] = 'notification'
        ndict['time'] = time.time()
        self.messages.append(ndict)

        db.remove()
Пример #4
0
    def notify(self, message='', data={}, listener=None):

        db = get_session()

        data['notification_type'] = listener if listener else 'unknown'

        n = Notif(message=toUnicode(message), data=data)
        db.add(n)
        db.commit()

        ndict = n.to_dict()
        ndict['type'] = 'notification'
        ndict['time'] = time.time()

        self.frontend(type=listener, data=data)

        return True
Пример #5
0
    def notify(self, message = '', data = {}, listener = None):

        db = get_session()

        data['notification_type'] = listener if listener else 'unknown'

        n = Notif(
            message = toUnicode(message),
            data = data
        )
        db.add(n)
        db.commit()

        ndict = n.to_dict()
        ndict['type'] = 'notification'
        ndict['time'] = time.time()
        self.messages.append(ndict)

        #db.close()
        return True
Пример #6
0
    def notify(self, message = '', data = None, listener = None):
        if not data: data = {}

        db = get_session()

        data['notification_type'] = listener if listener else 'unknown'

        n = Notif(
            message = toUnicode(message),
            data = data
        )
        db.add(n)
        db.commit()

        ndict = n.to_dict()
        ndict['type'] = 'notification'
        ndict['time'] = time.time()

        self.frontend(type = listener, data = data)

        return True
Пример #7
0
    def notify(self, message='', data=None, listener=None):
        if not data: data = {}

        try:
            db = get_session()

            data['notification_type'] = listener if listener else 'unknown'

            n = Notif(message=toUnicode(message), data=data)
            db.add(n)
            db.commit()

            ndict = n.to_dict()
            ndict['type'] = 'notification'
            ndict['time'] = time.time()

            self.frontend(type=listener, data=data)

            return True
        except:
            log.error('Failed notify: %s', traceback.format_exc())
            db.rollback()
        finally:
            db.close()