Fantomas42 / django-blog-zinnia

Simple yet powerful and really extendable application for managing a blog within your Django Web site.
http://django-blog-zinnia.com/
BSD 3-Clause "New" or "Revised" License
2.11k stars 730 forks source link

Password protected entries have an incomplete context #553

Open adongy opened 5 years ago

adongy commented 5 years ago

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

Disclaimer

Before submitting an issue make sure you have:

adongy commented 5 years ago

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