diff roundup/cgi/exceptions.py @ 5630:07abc8d36940

Add etag support to rest interface to prevent multiple users from overwriting other users changes. All GET requests for an object (issue, user, keyword etc.) or a property of an object (e.g the title of an issue) return the etag for the object in the ETag header as well as the @etag field in the returned object. All requests that change existing objects (DELETE, PUT or PATCH) require: 1 A request include an ETag header with the etag value retrieved for the object. 2 A submits a form that includes the field @etag that must have the value retrieved for the object. If an etag is not supplied by one of these methods, or any supplied etag does not match the etag calculated at the time the DELETE, PUT or PATCH request is made, HTTP error 412 (Precondition Failed) is returned and no change is made. At that time the client code should retrieve the object again, reconcile the changes and can try to send a new update. The etag is the md5 hash of the representation (repr()) of the object retrieved from the database.
author John Rouillard <rouilj@ieee.org>
date Fri, 01 Mar 2019 22:57:07 -0500
parents 32f95ec6bd8e
children 1a835db41674
line wrap: on
line diff
--- a/roundup/cgi/exceptions.py	Wed Feb 27 21:47:39 2019 -0500
+++ b/roundup/cgi/exceptions.py	Fri Mar 01 22:57:07 2019 -0500
@@ -18,6 +18,9 @@
 class NotModified(HTTPException):
     pass
 
+class PreconditionFailed(HTTPException):
+    pass
+
 class DetectorError(BaseException):
     """Raised when a detector throws an exception.
 Contains details of the exception."""

Roundup Issue Tracker: http://roundup-tracker.org/