Skip to content

Commit

Permalink
fix: missing go dependency exception with default options
Browse files Browse the repository at this point in the history
Resolves #97
  • Loading branch information
mrf345 committed Jul 14, 2024
1 parent 9078b8f commit 86aa603
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions flask_minify/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,23 @@ def __init__(
runtime_options={},
go=False,
):
self.default_parsers = self._go_default_parsers if go else self._default_parsers
self.go = go
self.parsers = {**self.default_parsers, **parsers}
self.runtime_options = {**runtime_options}
self.fail_safe = fail_safe
self.go = go

if self.has_go_parser and not minify_go:
raise FlaskMinifyException(
f"Cannot use any Go parsers without installing "
"Go optional dependency: `pip install flask-minify[go]`"
)

@property
def default_parsers(self):
return (
self._go_default_parsers if self.go and minify_go else self._default_parsers
)

@property
def has_go_parser(self):
return any(p.go for p in self.parsers.values())
Expand Down

0 comments on commit 86aa603

Please sign in to comment.