Skip to content

Commit 498736e

Browse files
committed
slight refactor; escape html strings before checking
1 parent 1815da0 commit 498736e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

permafrost/permissions.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@ def has_all_permissions(request, check_list=[]):
7474
qry['content_type__app_label'] = app_label
7575
if codename:
7676
qry['codename'] = codename
77-
perms = user_permissions.filter(**qry)
78-
has_permission = True
79-
if not perms:
77+
78+
if user_permissions.filter(**qry):
79+
has_permission = True
80+
else:
8081
return False
8182

8283
return has_permission

permafrost/tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,13 +328,14 @@ def test_manage_permafrost_roles_returns_correct_template(self):
328328

329329
def test_permafrostrole_manage_template_displays_list_of_roles_on_site(self):
330330
uri = reverse('permafrost:roles-manage')
331+
import html
331332
response = self.client.get(uri)
332333
objects = PermafrostRole.on_site.all()
333334

334335
self.assertTrue(len(objects))
335336

336337
for object in objects:
337-
self.assertContains(response, f'{object}')
338+
self.assertContains(response, html.escape(f'{object}'))
338339

339340
def test_permafrostrole_manage_template_displays_selected_role_details(self):
340341
uri = reverse('permafrost:roles-manage')

0 commit comments

Comments
 (0)