Fantomas42/django-blog-zinnia

Password protected entries have an incomplete context

Opened this issue · 1 comments

When setting a password on an entry, you go through the EntryProtectionMixin
, which renders an intermediate view (password). It uses an extra context attribute to render properly (namely, was the password correct). Hoever, it completely overrides the context, making all your context processors missing.

Actual behavior

Missing context values. It ends up as

context = [{'True': True, 'False': False, 'None': None}, {}, {}, {'error': False}]

Expected behavior

We have access to the whole context in the password view, with an extra attribute called "error".

Steps to reproduce the issue

  1. Create en entry with a password
  2. Try to access something provided by context processors in the template that is not error
  3. Get a KeyError

Specifications

  • Zinnia version: django-blog-zinnia==0.20
  • Django version: Django==2.1
  • Python version: Python 3.7.1
  • Operating system: macOS

Disclaimer

Before submitting an issue make sure you have:

  • Read the guidelines for contributing.
  • Checked for duplicate issues.
  • Not a support request.

A suggested fix it to use the standard get_context_data and add the error attribute there. I can submit a PR if needed.