misc: don't rely on is_anonymous being a CallableBool (#31026)

This commit is contained in:
Frédéric Péters 2019-03-01 11:23:12 +01:00
parent 77c4131be4
commit 5e5d3d4f72
2 changed files with 2 additions and 1 deletions

View File

@ -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()

View File

@ -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)