From 2f49dc8abc624dc02f183f348c83910e03ee7255 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Sat, 20 Jul 2019 18:42:30 +0200 Subject: [PATCH] Fix logic error in sessions.py > if data['state'] is not 'draft' or not 'pending': The second half of this if statement is __always__ False because __python -c "print(not 'pending')"__ # --> False The correct ways to write this line are: ```python if data['state'] != 'draft' or data['state'] != 'pending': # or better yet... if data['state'] not in ('draft', 'pending'): ``` --- app/api/schema/sessions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/schema/sessions.py b/app/api/schema/sessions.py index 76fe7ba1af..3d35bb0506 100644 --- a/app/api/schema/sessions.py +++ b/app/api/schema/sessions.py @@ -54,7 +54,7 @@ def validate_date(self, data, original_data): {'pointer': '/data/attributes/starts-at'}, "starts-at should be after current date-time") if 'state' in data: - if data['state'] is not 'draft' or not 'pending': + if data['state'] not in ('draft', 'pending'): if not has_access('is_coorganizer', event_id=data['event']): return ForbiddenException({'source': ''}, 'Co-organizer access is required.')