chibisov / drf-extensions

DRF-extensions is a collection of custom extensions for Django REST Framework
http://chibisov.github.io/drf-extensions/docs
MIT License
1.48k stars 208 forks source link

Refactor bulk processing using new decorators #172

Open pkainz opened 7 years ago

pkainz commented 7 years ago

PR https://github.com/chibisov/drf-extensions/pull/171 introduces a new generic decorator @precondition_required. It enables the check for a set of preconditions (i.e. required HTTP headers). If the precondition is not met, a 428 PRECONDITION REQUIRED exception will be raised, rendered as rest_framework.exceptions.APIException to API clients.
Optimistic concurrency control (OCC) has been implemented using ETags to identify the 'version' of an API resource. It combines the existing @etag decorator and @precondition_required to enforce the header check in OCC.

The @precondition_required decorator is versatile and can be used to check for custom request headers. Such a header is used in bulk-processing in drf-extensions, so refactoring using the new decorator seems possible.

auvipy commented 5 years ago

Hi, still interested n this?