From ccf5b416d7b7a0e1aef78ae4cf246540fe4fc246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Mon, 18 May 2015 19:53:40 +0200 Subject: [PATCH] backoffice: add jsonp support to backoffice/menu.json endpoint (#7146) --- wcs/backoffice/root.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wcs/backoffice/root.py b/wcs/backoffice/root.py index a74c527..2edb577 100644 --- a/wcs/backoffice/root.py +++ b/wcs/backoffice/root.py @@ -208,7 +208,12 @@ class RootDirectory(BackofficeRootDirectory): get_response().set_header('Access-Control-Allow-Headers', 'x-requested-with') menu_items = [] backoffice_url = get_publisher().get_backoffice_url() - return json.dumps(self.get_menu_items()) + json_str = json.dumps(self.get_menu_items()) + for variable in ('jsonpCallback', 'callback'): + if variable in get_request().form: + json_str = '%s(%s);' % (get_request().form[variable], json_str) + break + return json_str def pending(self): # kept as a redirection for compatibility with possible bookmarks -- 2.1.4