Exemple #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()
Exemple #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
    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()
Exemple #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
Exemple #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
Exemple #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
Exemple #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()