Add the `alters_data` attribute on `Page.copy()`.

This makes sure the variable can't be printed in the template,
performing an accidental copy of the page. That also happened when using
the `{% print %}` tag from my django-debugtools package
pull/3190/head
Diederik van der Boor 2016-11-29 11:10:12 +01:00 zatwierdzone przez Matt Westcott
rodzic ba4119bd26
commit f960753d74
3 zmienionych plików z 4 dodań i 0 usunięć

Wyświetl plik

@ -33,6 +33,7 @@ Changelog
* Fix: `search_garbage_collect` management command now works when wagtailsearchpromotions is not installed (Morgan Aubert)
* Fix: `wagtail.contrib.settings` context processor no longer fails when `request.site` is unavailable (Diederik van der Boor)
* Fix: `TableBlock` content is now indexed for search (Morgan Aubert)
* Fix: `Page.copy()` is now marked as `alters_data`, to prevent template code from triggering it (Diederik van der Boor)
1.7 (20.10.2016)

Wyświetl plik

@ -64,6 +64,7 @@ Bug fixes
* ``search_garbage_collect`` management command now works when wagtailsearchpromotions is not installed (Morgan Aubert)
* ``wagtail.contrib.settings`` context processor no longer fails when ``request.site`` is unavailable (Diederik van der Boor)
* ``TableBlock`` content is now indexed for search (Morgan Aubert)
* Fix: ``Page.copy()`` is now marked as ``alters_data``, to prevent template code from triggering it (Diederik van der Boor)
Upgrade considerations

Wyświetl plik

@ -1182,6 +1182,8 @@ class Page(six.with_metaclass(PageBase, AbstractPage, index.Indexed, Clusterable
return page_copy
copy.alters_data = True
def permissions_for_user(self, user):
"""
Return a PagePermissionsTester object defining what actions the user can perform on this page