From 5e5d3d4f7276280dc56634f81ba67098d47b705c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 1 Mar 2019 11:23:12 +0100 Subject: [PATCH] misc: don't rely on is_anonymous being a CallableBool (#31026) --- combo/data/models.py | 2 +- tests/test_manager.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/combo/data/models.py b/combo/data/models.py index 73e86a1e..dc141450 100644 --- a/combo/data/models.py +++ b/combo/data/models.py @@ -439,7 +439,7 @@ class PageSnapshot(models.Model): @classmethod def take(cls, page, request=None, comment=None, deletion=False): snapshot = cls(page=page, comment=comment) - if request and not request.user.is_anonymous: + if request and not request.user.is_anonymous(): snapshot.user = request.user if not deletion: snapshot.serialization = page.get_serialized_page() diff --git a/tests/test_manager.py b/tests/test_manager.py index 3352854d..6bc24b3a 100644 --- a/tests/test_manager.py +++ b/tests/test_manager.py @@ -954,6 +954,7 @@ def test_page_versionning(app, admin_user): assert not 'Hello world' in resp2.text assert Page.objects.all().count() == 1 + assert PageSnapshot.objects.filter(page=page)[0].user.username == 'admin' # check with asynchronous cells resp = app.get('/manage/pages/%s/add-cell-to-content/data_jsoncell/default/' % page.id)