misc: don't rely on is_anonymous being a CallableBool (#31026)
This commit is contained in:
parent
77c4131be4
commit
5e5d3d4f72
|
@ -439,7 +439,7 @@ class PageSnapshot(models.Model):
|
||||||
@classmethod
|
@classmethod
|
||||||
def take(cls, page, request=None, comment=None, deletion=False):
|
def take(cls, page, request=None, comment=None, deletion=False):
|
||||||
snapshot = cls(page=page, comment=comment)
|
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
|
snapshot.user = request.user
|
||||||
if not deletion:
|
if not deletion:
|
||||||
snapshot.serialization = page.get_serialized_page()
|
snapshot.serialization = page.get_serialized_page()
|
||||||
|
|
|
@ -954,6 +954,7 @@ def test_page_versionning(app, admin_user):
|
||||||
assert not 'Hello world' in resp2.text
|
assert not 'Hello world' in resp2.text
|
||||||
|
|
||||||
assert Page.objects.all().count() == 1
|
assert Page.objects.all().count() == 1
|
||||||
|
assert PageSnapshot.objects.filter(page=page)[0].user.username == 'admin'
|
||||||
|
|
||||||
# check with asynchronous cells
|
# check with asynchronous cells
|
||||||
resp = app.get('/manage/pages/%s/add-cell-to-content/data_jsoncell/default/' % page.id)
|
resp = app.get('/manage/pages/%s/add-cell-to-content/data_jsoncell/default/' % page.id)
|
||||||
|
|
Loading…
Reference in New Issue