def activate(session: session, activator: callable): """ load rules - executed on commit raises exception if cycles detected :param session: SQLAlchemy session :param activator: function that declares rules (e.g., Rule.sum...) :return: """ engine = session.bind.engine setup(session, engine) activator() validate(session, engine)
+ required_path_python_rules) sys.path.append(required_path_python_rules) else: pass print("NOT Fixing path (default PyCharm, set in VSC Launch Config): " + required_path_python_rules) from logic_bank.rule_bank import rule_bank_withdraw # required to avoid circular imports from logic_bank.rule_bank import rule_bank_setup from banking.logic.rules_bank import activate_basic_rules """ Logging configuration """ logging.basicConfig(format="%(asctime)s:%(levelname)s:%(name)s:%(message)s") logging.getLogger().setLevel(logging.DEBUG) app = Flask(__name__) app.config.from_object("config") db = SQLA(app) appbuilder = AppBuilder(app, db.session) if use_rules: rule_bank_setup.setup(db.session, db.engine) activate_basic_rules() rule_bank_setup.validate(db.session, db.engine) # checks for cycles, etc from . import views