Exemple #1
0
    def fill(self):

        db = get_session()

        for identifier, label in self.statuses.iteritems():
            s = db.query(Status).filter_by(identifier=identifier).first()
            if not s:
                log.info("Creating status: %s", label)
                s = Status(identifier=identifier, label=toUnicode(label))
                db.add(s)

            s.label = toUnicode(label)
            db.commit()
Exemple #2
0
    def fill(self):

        db = get_session()

        for identifier, label in self.statuses.iteritems():
            s = db.query(Status).filter_by(identifier=identifier).first()
            if not s:
                log.info('Creating status: %s', label)
                s = Status(identifier=identifier, label=toUnicode(label))
                db.add(s)

            s.label = toUnicode(label)
            db.commit()
Exemple #3
0
    def fill(self):

        try:
            db = get_session()

            for identifier, label in self.statuses.items():
                s = db.query(Status).filter_by(identifier=identifier).first()
                if not s:
                    log.info('Creating status: %s', label)
                    s = Status(identifier=identifier, label=toUnicode(label))
                    db.add(s)

                s.label = toUnicode(label)
                db.commit()
        except:
            log.error('Failed: %s', traceback.format_exc())
            db.rollback()
        finally:
            db.close()
Exemple #4
0
    def fill(self):

        try:
            db = get_session()

            for identifier, label in self.statuses.items():
                s = db.query(Status).filter_by(identifier = identifier).first()
                if not s:
                    log.info('Creating status: %s', label)
                    s = Status(
                        identifier = identifier,
                        label = toUnicode(label)
                    )
                    db.add(s)

                s.label = toUnicode(label)
                db.commit()
        except:
            log.error('Failed: %s', traceback.format_exc())
            db.rollback()
        finally:
            db.close()