def _pull_beancount_file(_, values) -> None: g.beancount_file_slug = values.pop("bfile", None) if values else None with LOAD_FILE_LOCK: if not app.config.get("LEDGERS"): _load_file() if g.beancount_file_slug: if g.beancount_file_slug not in app.config["FILE_SLUGS"]: abort(404) g.ledger = app.config["LEDGERS"][g.beancount_file_slug] g.conversion = request.args.get("conversion", g.ledger.fava_options["conversion"]) g.interval = Interval.get( request.args.get("interval", g.ledger.fava_options["interval"]))
def _pull_beancount_file(_, values): g.beancount_file_slug = values.pop('bfile', None) if values else None if not app.config.get('LEDGERS'): _load_file() if not g.beancount_file_slug: g.beancount_file_slug = app.config['FILE_SLUGS'][0] if g.beancount_file_slug not in app.config['FILE_SLUGS']: abort(404) g.ledger = app.config['LEDGERS'][g.beancount_file_slug] g.conversion = request.args.get('conversion') g.partial = request.args.get('partial', False) g.interval = Interval.get( request.args.get('interval', g.ledger.fava_options['interval']))
def _pull_beancount_file(_, values): g.beancount_file_slug = values.pop('bfile', None) if values else None with LOAD_FILE_LOCK: if not app.config.get('LEDGERS'): _load_file() if not g.beancount_file_slug: g.beancount_file_slug = app.config['FILE_SLUGS'][0] if g.beancount_file_slug not in app.config['FILE_SLUGS']: abort(404) g.ledger = app.config['LEDGERS'][g.beancount_file_slug] g.conversion = request.args.get('conversion') g.partial = request.args.get('partial', False) g.interval = Interval.get(request.args.get( 'interval', g.ledger.fava_options['interval']))
def _pull_beancount_file(_, values) -> None: g.beancount_file_slug = values.pop("bfile", None) if values else None with LOAD_FILE_LOCK: if not app.config.get("LEDGERS"): _load_file() if g.beancount_file_slug: if g.beancount_file_slug not in app.config["LEDGERS"]: if not any(g.beancount_file_slug == ledger_slug(ledger) for ledger in app.config["LEDGERS"].values()): abort(404) # one of the file slugs changed, update the mapping update_ledger_slugs(app.config["LEDGERS"].values()) g.ledger = app.config["LEDGERS"][g.beancount_file_slug] g.conversion = request.args.get("conversion", "at_cost") g.interval = Interval.get(request.args.get("interval", "month"))
def test_interval(): assert Interval.get('month') is Interval.MONTH assert Interval.get('year') is Interval.YEAR assert Interval.get('YEAR') is Interval.YEAR assert Interval.get('asdfasdf') is Interval.MONTH
def test_interval(): assert Interval.get("month") is Interval.MONTH assert Interval.get("year") is Interval.YEAR assert Interval.get("YEAR") is Interval.YEAR assert Interval.get("asdfasdf") is Interval.MONTH
def test_interval(): assert Interval.get('month') is Interval.MONTH assert Interval.get('year') is Interval.YEAR assert Interval.get('YEAR') is Interval.YEAR assert Interval.get('asdfasdf') is Interval.MONTH