Skip to content

Commit

Permalink
Merge pull request #176 from palewire/pathlib
Browse files Browse the repository at this point in the history
Allow pathlib and fix #175
  • Loading branch information
palewire authored Mar 14, 2023
2 parents d232733 + 89ff764 commit a3923c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
_dist/
.eggs
.env
__pycache__
*.egg-*
Expand Down
7 changes: 7 additions & 0 deletions bakery/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import boto3
import json
import random
from pathlib import Path
from moto import mock_s3
from datetime import date
from .. import views, feeds
Expand Down Expand Up @@ -420,6 +421,12 @@ def test_build_cmd(self):
favicon_path = os.path.join(settings.BUILD_DIR, 'favicon.ico')
self.assertTrue(os.path.exists(favicon_path))

def test_build_pathlib(self):
with self.settings(BUILD_DIR=Path(__file__).parent / "_dist"):
call_command("build", **{'verbosity': 3})
with self.settings(STATIC_ROOT=Path(__file__).parent / "_static"):
call_command("build", **{'verbosity': 3})

def test_unbuild_cmd(self):
call_command("unbuild")

Expand Down
2 changes: 1 addition & 1 deletion bakery/views/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def get_build_path(self, obj):
would like your detail page at a different location. By default it
will be built at get_url() + "index.html"
"""
target_path = path.join(settings.BUILD_DIR, self.get_url(obj).lstrip('/'))
target_path = path.join(str(settings.BUILD_DIR), self.get_url(obj).lstrip('/'))
if not self.fs.exists(target_path):
logger.debug("Creating {}".format(target_path))
self.fs.makedirs(target_path)
Expand Down

0 comments on commit a3923c9

Please sign in to comment.