webrecorder / pywb

Core Python Web Archiving Toolkit for replay and recording of web archives
https://pypi.python.org/pypi/pywb
GNU General Public License v3.0
1.34k stars 207 forks source link

Dependencies of per-collection templates #830

Open despens opened 1 year ago

despens commented 1 year ago

When customizing a single template for a collection, for instance not_found.html, template dependencies are not resolved and lead to rendering or server errors.

Steps to reproduce the bug

  1. Start out with new pywb 2.7 install.
  2. Initialize a new collection test via wb-manager init test
  3. Create custom error message for the collection via wb-manager template --add not_found_html
  4. files base.html and not_found.html appear in collections/test/templates/.
  5. Request page in collection that does not exist, for instance http://localhost/8080/test/wobble-wobble.html
  6. pywb shows unstyled error page
  7. remove collections/test/templates/base.html
  8. reload pywb page
  9. pywb responds with Internal Server Error

Expected behavior

The template should display correctly. Any template dependencies should be looked up in the current collection's templates directory, if not present fall back to the deployment's base template directory, and finally to pywb's distribution directory.

Otherwise it will be very hard to customize a single template for a collection, as that would mean to "fork" the whole template dependency chain. Curators would need to manage all templates for all collection after possible pywb updates.

ruebot commented 9 months ago

I'm hitting this error too with 2.7.4.