From 96c3002c247545f1f42f6e7c57be4adb68d3680b Mon Sep 17 00:00:00 2001 From: Benjamin Dauvergne Date: Thu, 29 Sep 2016 13:34:17 +0200 Subject: [PATCH 1/2] add HttpRequest.get_version to help in API versionning (#13184) --- wcs/qommon/http_request.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wcs/qommon/http_request.py b/wcs/qommon/http_request.py index 2cc4591..90388d2 100644 --- a/wcs/qommon/http_request.py +++ b/wcs/qommon/http_request.py @@ -144,3 +144,10 @@ class HTTPRequest(quixote.http_request.HTTPRequest): def is_in_backoffice(self): return self.get_path().startswith('/backoffice/') + + def get_api_version(self): + '''Helper for API versionning''' + try: + return int(self.form.get('api_version', 0)) + except ValueError: + return 0 -- 2.1.4