示例#1
0
class UserStore(borg.Borg):
    try:
        _store = Store(Database().get_database())
    except DatabaseException:
        _store = None

    def get_store(self):
        return self._store
示例#2
0
    def perform(self, args):
        opts = self.parse_args(args)
        if userquery('ATENTION: This command will delete any project tables at'\
                   ' database server.\nWould you like yo continue?')=='no':
            print '\nQuitting.'
            sys.exit(1)
        print '\n' + bold('Creating tables...')
        gen = Generator(opts['verbose'])
        gen.generate_database()
        tables = gen.get_database()
        db = Database()
        db.connect()

        for table in tables:
            if opts['verbose']:
                print bold('Creating table {0}...'.format(table['name']))
            db.create(table['script'])

        print bold('Database created successfully.')
示例#3
0
 def __init__(self):
     super(Model, self).__init__()
     self._schema = Database().get_schema()