@@ -430,7 +430,7 @@ class Patch(Submission):
if not user.is_authenticated():
return False
- if self.submitter.user == user or self.delegate == user:
+ if user in [self.submitter.user, self.delegate]:
return True
return self.project.is_editable(user)
@@ -473,7 +473,7 @@ def parse_patch(content):
state = 0
commentbuf += buf + line
buf = ''
- elif state == 4 or state == 5:
+ elif state in [4, 5]:
if line.startswith('-'):
lc[0] -= 1
elif line.startswith('+'):
@@ -159,7 +159,7 @@ def set_bundle(request, project, action, data, patches, context):
return ['no such bundle']
for patch in patches:
- if action == 'create' or action == 'add':
+ if action in ['create', 'add']:
bundlepatch_count = BundlePatch.objects.filter(bundle=bundle,
patch=patch).count()
if bundlepatch_count == 0:
Don't do 'x == a or x == b'. Prefer 'x in [a, b]' instead. Signed-off-by: Stephen Finucane <stephenfinucane@hotmail.com> --- patchwork/models.py | 2 +- patchwork/parser.py | 2 +- patchwork/views/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)