diff --git a/README.md b/README.md index b1a5ef9..c6dc9e1 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,19 @@ A set of helpers for baking your Django Wagtail site out as flat files. [![Build Status](https://travis-ci.org/wagtail/wagtail-bakery.svg?branch=master)](https://travis-ci.org/wagtail/wagtail-bakery) [![Coverage Status](https://coveralls.io/repos/github/wagtail/wagtail-bakery/badge.svg?branch=master)](https://coveralls.io/github/wagtail/wagtail-bakery?branch=master) -* Issues: [https://github.com/wagtail/wagtail-bakery/issues](https://github.com/wagtail/wagtail-bakery/issues) -* Testing: [https://travis-ci.org/wagtail/wagtail-bakery](https://travis-ci.org/wagtail/wagtail-bakery) -* Coverage: [https://coveralls.io/github/wagtail/wagtail-bakery](https://coveralls.io/github/wagtail/wagtail-bakery) +- Issues: [https://github.com/wagtail/wagtail-bakery/issues](https://github.com/wagtail/wagtail-bakery/issues) +- Testing: [https://travis-ci.org/wagtail/wagtail-bakery](https://travis-ci.org/wagtail/wagtail-bakery) +- Coverage: [https://coveralls.io/github/wagtail/wagtail-bakery](https://coveralls.io/github/wagtail/wagtail-bakery) Wagtail-bakery is built on top of [Django bakery](https://github.com/datadesk/django-bakery). Please read their [documentation](https://django-bakery.readthedocs.io/en/latest/) for detailed configuration and how to build default Django flat files. Yes. Wagtail-bakery is not limited to build Wagtail pages specifically, mixed content is possible! ## Features -* Single management command that will build your Wagtail site out as flat files -* Support for multisite, [theming](https://github.com/wagtail/wagtail-themes) and [multilingual](http://docs.wagtail.io/en/latest/advanced_topics/i18n/index.html) setup -* Support for `i18n_patterns` -* Support for generating a static API -* Ready to use Wagtail Buildable views to build all your (un)published pages at once (no extra code required!) +- Single management command that will build your Wagtail site out as flat files +- Support for multisite, [theming](https://github.com/wagtail/wagtail-themes) and [multilingual](http://docs.wagtail.io/en/latest/advanced_topics/i18n/index.html) setup +- Support for `i18n_patterns` +- Support for generating a static API +- Ready to use Wagtail Buildable views to build all your (un)published pages at once (no extra code required!) ## Installation @@ -79,6 +79,16 @@ BAKERY_VIEWS = ( The API views use Wagtail's V2 API module. To configure the data that is rendered by these views, please refer to Wagtail's [V2 API configuration guide](http://docs.wagtail.io/en/stable/advanced_topics/api/v2/configuration.html). +In case the static file for a page fails to build (for example, because the file +name would be too long for the filesystem's maximum file name length), you can +configure wagtail-bakery to ignore the page and continue to build the rest of +the static archive. The default behavior is that wagtail-bakery will throw the +error and stop the build. + +```py +BAKERY_IGNORE_OBJECTS_THAT_FAILED_TO_BUILD = True +``` + ## Usage Build the site out as flat files by running the `build` management command. @@ -140,6 +150,7 @@ Django/Wagtail combinations as [supported](http://docs.wagtail.io/en/latest/rele In order to keep for CI build time from growing out of control, not all Python/Django/Wagtail combinations will be tested. Test as follow: + - All supported Django/Wagtail combinations with the latest supported Python version. - The latest supported Django/Wagtail combination for the remaining Python versions. @@ -157,7 +168,7 @@ For issues [please submit an issue](https://github.com/wagtail/wagtail-bakery/is 1. Update `CHANGELOG.md`. 1. On GitHub, create a pull request and squash merge it. 1. Checkout and pull the `master` branch locally. -1. (Optional) If you need to verify anything, use `make publish-test` to upload to https://test.pypi.org and enter your PyPi *test* credentials as needed. +1. (Optional) If you need to verify anything, use `make publish-test` to upload to https://test.pypi.org and enter your PyPi _test_ credentials as needed. 1. Use `make publish` and enter your PyPi credentials as needed. 1. On GitHub, create a release and a tag for the new version. diff --git a/src/wagtailbakery/views.py b/src/wagtailbakery/views.py index 5ed967f..9b5af2a 100644 --- a/src/wagtailbakery/views.py +++ b/src/wagtailbakery/views.py @@ -91,8 +91,14 @@ def build_object(self, obj): self.request = RequestFactory( SERVER_NAME=site.hostname).get(self.get_url(obj)) self.set_kwargs(obj) - path = self.get_build_path(obj) - self.build_file(path, self.get_content(obj)) + try: + path = self.get_build_path(obj) + self.build_file(path, self.get_content(obj)) + except (OSError, AttributeError) as exc: + if getattr(settings, 'BAKERY_IGNORE_OBJECTS_THAT_FAILED_TO_BUILD', False): + logger.exception("Failed to build object %s: %s" % (obj, exc)) + else: + raise exc def build_queryset(self): for item in self.get_queryset().all():