def initialize_system(password=None, testsuite=False, force=False): """Call all the necessary methods to startup Stoq applications for every purpose: production usage, testing or demonstration """ log.info("Initialize_system") try: db_settings.clean_database(db_settings.dbname, force=force) create_base_schema() create_log("INIT START") store = new_store() populate_initial_data(store) register_accounts(store) register_payment_methods(store) from stoqlib.domain.uiform import create_default_forms create_default_forms(store) store.commit(close=True) ensure_sellable_constants() ensure_system_parameters() _ensure_card_providers() create_default_profiles() _install_invoice_templates() if not testsuite: create_default_profile_settings() ensure_admin_user(password) except Exception, e: raise if not testsuite: collect_traceback(sys.exc_info(), submit=True) raise SystemExit("Could not initialize system: %r" % (e, ))
def initialize_system(password=None, testsuite=False, force=False): """Call all the necessary methods to startup Stoq applications for every purpose: production usage, testing or demonstration """ log.info("Initialize_system") try: db_settings.clean_database(db_settings.dbname, force=force) create_base_schema() create_log("INIT START") store = new_store() populate_initial_data(store) register_accounts(store) register_payment_methods(store) from stoqlib.domain.uiform import create_default_forms create_default_forms(store) store.commit(close=True) ensure_sellable_constants() ensure_system_parameters() _ensure_card_providers() create_default_profiles() _install_invoice_templates() if not testsuite: create_default_profile_settings() ensure_admin_user(password) except Exception as e: raise if not testsuite: collect_traceback(sys.exc_info(), submit=True) raise SystemExit("Could not initialize system: %r" % (e, )) create_log("INIT DONE")
def after_update(self): # checks if there is new applications and update all the user # profiles on the system store = new_store() update_profile_applications(store) store.commit(close=True) # Updating the parameter list ensure_system_parameters(update=True)