Esempio n. 1
0
    def run(self, args):
        super(PopulateCommand, self).run(args)
        self.load_app()

        print "=" * 80
        print BLUE + "LOADING ENVIRONMENT" + ENDS
        print "=" * 80

        print BLUE + "BUILDING SCHEMA" + ENDS
        print "=" * 80
        try:
            print "STARTING A TRANSACTION..."
            print "=" * 80
            model.start()
            model.metadata.create_all()

            print BLUE + "GENERATING INGREDIENTS" + ENDS
            print "=" * 80
            populate()
        except:
            model.rollback()
            print "=" * 80
            print "%s ROLLING BACK... %s" % (RED, ENDS)
            print "=" * 80
            raise
        else:
            print "=" * 80
            print "%s COMMITING... %s" % (GREEN, ENDS)
            print "=" * 80
            model.commit()
Esempio n. 2
0
def run():
    print "="*80
    print BLUE + "LOADING ENVIRONMENT" + ENDS
    print "="*80
    EnvCommand('env').run([sys.argv[1]])

    print BLUE + "BUILDING SCHEMA" + ENDS
    print "="*80
    try:
        print "STARTING A TRANSACTION..."
        print "="*80
        model.start()
        model.metadata.create_all()

        print BLUE + "GENERATING INGREDIENTS" + ENDS
        print "="*80
        populate()
    except:
        model.rollback()
        print "="*80
        print "%s ROLLING BACK... %s" % (RED, ENDS)
        print "="*80
        raise
    else:
        print "="*80
        print "%s COMMITING... %s" % (GREEN, ENDS)
        print "="*80
        model.commit()
Esempio n. 3
0
    def run(self, args):
        super(PopulateCommand, self).run(args)
        self.load_app()

        print "=" * 80
        print BLUE + "LOADING ENVIRONMENT" + ENDS
        print "=" * 80

        print BLUE + "BUILDING SCHEMA" + ENDS
        print "=" * 80
        try:
            print "STARTING A TRANSACTION..."
            print "=" * 80
            model.start()
            model.metadata.create_all()

            print BLUE + "GENERATING INGREDIENTS" + ENDS
            print "=" * 80
            populate()
        except:
            model.rollback()
            print "=" * 80
            print "%s ROLLING BACK... %s" % (RED, ENDS)
            print "=" * 80
            raise
        else:
            print "=" * 80
            print "%s COMMITING... %s" % (GREEN, ENDS)
            print "=" * 80
            model.commit()