changeset b0684e2aa5b0 in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=b0684e2aa5b0
description:
        Add context to export URL

        issue9304
        review317361002
diffstat:

 CHANGELOG            |  2 ++
 trytond/ir/routes.py |  9 +++++++++
 2 files changed, 11 insertions(+), 0 deletions(-)

diffs (28 lines):

diff -r 23342a60ff35 -r b0684e2aa5b0 CHANGELOG
--- a/CHANGELOG Sun May 10 12:02:59 2020 +0200
+++ b/CHANGELOG Tue May 19 19:36:09 2020 +0200
@@ -1,3 +1,5 @@
+* Add context to export CSV route
+
 Version 5.6.0 - 2020-05-04
 * Bug fixes (see mercurial logs for details)
 * Call getter function when accessing Function field on unsaved record
diff -r 23342a60ff35 -r b0684e2aa5b0 trytond/ir/routes.py
--- a/trytond/ir/routes.py      Sun May 10 12:02:59 2020 +0200
+++ b/trytond/ir/routes.py      Tue May 19 19:36:09 2020 +0200
@@ -191,6 +191,15 @@
             request.args.get('d', '[]'), object_hook=JSONDecoder())
     except json.JSONDecodeError:
         abort(HTTPStatus.BAD_REQUEST)
+    try:
+        ctx = json.loads(
+            request.args.get('c', '{}'), object_hook=JSONDecoder())
+    except json.JSONDecoder:
+        abort(HTTPStatus.BAD_REQUEST)
+    for key in list(ctx.keys()):
+        if key.startswith('_') and key != '_datetime':
+            del ctx[key]
+    context.update(ctx)
     limit = None
     offset = 0
     if 's' in request.args:

Reply via email to