Skip to content

Commit

Permalink
Ensure Compatibility with flask_frozen v1.0.1 (#182)
Browse files Browse the repository at this point in the history
This commit addresses an AttributeError encountered when using flask_frozen v1.0.1 with our CustomFreezer class. Previously, the CustomFreezer's root property was returning a string representation of
the cf_output_dir, which caused compatibility issues with the latest version of flask_frozen.

This update resolves the AttributeError ('str' object has no attribute 'mkdir') and ensures our CustomFreezer class works seamlessly with flask_frozen v1.0.1.
  • Loading branch information
greymd authored Jan 26, 2024
1 parent 0d26503 commit 29ee289
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Werkzeug<3.0.0
Flask<3.0.0
markdown2
emoji>=2.0.0,<3.0
frozen-flask
frozen-flask==1.0.1
10 changes: 8 additions & 2 deletions slackviewer/freezer.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from flask_frozen import Freezer
from pathlib import Path

class CustomFreezer(Freezer):

cf_output_dir = None

@property
def root(self):
return u"{}".format(self.cf_output_dir)

# Use the specified cf_output_dir if set
if self.cf_output_dir:
return Path(self.cf_output_dir)
# Otherwise, follow the default behavior of flask_frozen
else:
root = Path(self.app.root_path)
return root / self.app.config['FREEZER_DESTINATION']

0 comments on commit 29ee289

Please sign in to comment.