def init_db(config): tables = [ Entry, Users, Tag, Image, Hop, Grain, Extract, HoppedExtract, Yeast, Water, Misc, Mineral, Fining, Flavor, Spice, Herb, BJCPStyle, BJCPCategory, MashTun, BoilKettle, EquipmentSet, MashProfile, MashStep, MashStepOrder, Recipe, RecipeIngredient, Inventory, Comment, Role ] #, Permission] for table in tables: try: table.createTable() except OperationalError: pass else: # NEED TO FIX THIS if table.__name__ == 'Users': adef = config['ADMIN_USERNAME'] admin = Users(email=adef, first_name=adef, last_name=adef, alias=adef) admin.set_pass(config['PASSWORD_SALT'], config['ADMIN_PASSWORD']) admin.admin = True # uncomment when you're sorted out your little permissions thingy # for role in config['SYSTEM_ROLES']: # r = Role(name=role) # admin.addRole(config['SYSTEM_ROLES'].index(config['ADMIN'])) if table.__name__ == 'BJCPCategory': process_bjcp_styles() if table.__name__ == 'Inventory': process_bt_database()
def init_db(config): tables = [Entry, Users, Tag, Image, Hop, Grain, Extract, HoppedExtract, Yeast, Water, Misc, Mineral, Fining, Flavor, Spice, Herb, BJCPStyle, BJCPCategory, MashTun, BoilKettle, EquipmentSet, MashProfile, MashStep, MashStepOrder, Recipe, RecipeIngredient, Inventory, Comment, Role]#, Permission] for table in tables: try: table.createTable() except OperationalError: pass else: # NEED TO FIX THIS if table.__name__ == 'Users': adef = config['ADMIN_USERNAME'] admin = Users(email=adef, first_name=adef, last_name=adef, alias=adef) admin.set_pass(config['PASSWORD_SALT'], config['ADMIN_PASSWORD']) admin.admin = True # uncomment when you're sorted out your little permissions thingy # for role in config['SYSTEM_ROLES']: # r = Role(name=role) # admin.addRole(config['SYSTEM_ROLES'].index(config['ADMIN'])) if table.__name__ == 'BJCPCategory': process_bjcp_styles() if table.__name__ == 'Inventory': process_bt_database()