google-code-export / django-page-cms

Automatically exported from code.google.com/p/django-page-cms
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Placeholders block inheritance #210

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Spent few hours, before found this bug. Please, fix as soon as you can.

Let's imagine, we have base.html:
{% block parent %}
  {% block child %}
    Blah - blah
    {% placeholder one on current_page %}
    {% placeholder two on current_page %}
  {% endblock %}
{% endblock %}

And derived.html:
{% extends "base.html" %}
{% block parent %}
  {% block child %}
    {% placeholder one on current_page %}
     Ohh, blah blah!!
    {% placeholder two on current_page %}
  {% endblock %}
{% endblock %}

So, when i page with derived.html template, which contents should i see?
Both two contents? So, i see only one of them.
I've explored this lots with pdb and have a patch for you.
The problem is that looping via enumerate() and deleting items in the same list 
is a very bad idea, because after deleting an item, all the next items changes 
their indexes.

Original issue reported on code.google.com by klich...@gmail.com on 12 Oct 2010 at 11:27

Attachments:

GoogleCodeExporter commented 9 years ago
Wow, thanks for spotting this.

Could you write a little test that reproduce the bug?'

There is quite a few test examples that play with templates:

http://github.com/batiste/django-page-cms/blob/master/pages/tests/test_unit.py#L
118

Original comment by batiste....@gmail.com on 13 Oct 2010 at 8:46

GoogleCodeExporter commented 9 years ago
Never mind I managed to re-create the bug:

http://github.com/batiste/django-page-cms/commit/bd94670d85f12b0e47ac40d3848208d
c6c937412

Original comment by batiste....@gmail.com on 13 Oct 2010 at 9:25