patch
Patch.DoesNotExist: The patch did not exist.
"""
- try:
- ok_params = ['state', 'commit_ref', 'archived']
-
- patch = Patch.objects.get(id=patch_id)
+ ok_params = ['state', 'commit_ref', 'archived']
- if not patch.is_editable(user):
- raise Exception('No permissions to edit this patch')
+ patch = Patch.objects.get(id=patch_id)
- for (k, v) in params.items():
- if k not in ok_params:
- continue
+ if not patch.is_editable(user):
+ raise Exception('No permissions to edit this patch')
- if k == 'state':
- patch.state = State.objects.get(id=v)
+ for (k, v) in params.items():
+ if k not in ok_params:
+ continue
- else:
- setattr(patch, k, v)
+ if k == 'state':
+ patch.state = State.objects.get(id=v)
- patch.save()
+ else:
+ setattr(patch, k, v)
- return True
+ patch.save()
- except Patch.DoesNotExist:
- raise
+ return True
@xmlrpc_method()