2020-01-12 14:23:10 +01:00
|
|
|
from django.utils.html import escape
|
|
|
|
|
|
|
|
|
2019-12-28 15:37:09 +01:00
|
|
|
def in_content(response, object_to_find):
|
2019-08-11 21:35:21 +02:00
|
|
|
decoded_content = response.content.decode('utf8')
|
2020-01-12 14:23:10 +01:00
|
|
|
if str(escape(object_to_find)) not in decoded_content:
|
2019-08-11 21:35:21 +02:00
|
|
|
return False
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
2019-12-28 15:37:09 +01:00
|
|
|
def not_in_content(response, object_to_find):
|
2019-08-11 21:35:21 +02:00
|
|
|
decoded_content = response.content.decode('utf8')
|
2020-01-12 14:23:10 +01:00
|
|
|
if str(escape(object_to_find)) in decoded_content:
|
2019-08-11 21:35:21 +02:00
|
|
|
return False
|
|
|
|
return True
|