Update JSON response in containers views
authorThierry Florac <tflorac@ulthar.net>
Fri, 26 Jul 2019 12:36:57 +0200
changeset 532 d787b89ba9b8
parent 531 9091ad4b5c0a
child 533 d21c81597338
Update JSON response in containers views
src/pyams_skin/container.py
--- a/src/pyams_skin/container.py	Fri May 24 09:01:47 2019 +0200
+++ b/src/pyams_skin/container.py	Fri Jul 26 12:36:57 2019 +0200
@@ -10,24 +10,20 @@
 # FOR A PARTICULAR PURPOSE.
 #
 
-__docformat__ = 'restructuredtext'
-
+from pyramid.exceptions import NotFound
+from pyramid.httpexceptions import HTTPInternalServerError, HTTPUnauthorized
+from pyramid.view import view_config
+from zope.container.interfaces import IContainer
+from zope.interface import implementer
 
-# import standard library
-
-# import interfaces
+from pyams_form.security import get_edit_permission
 from pyams_skin.interfaces.container import IContainerBaseView
 from pyams_skin.layer import IPyAMSLayer
-from zope.container.interfaces import IContainer
-
-# import packages
-from pyams_form.security import get_edit_permission
 from pyams_skin.table import BaseTable
 from pyams_template.template import template_config
-from pyramid.exceptions import NotFound
-from pyramid.httpexceptions import HTTPUnauthorized, HTTPInternalServerError
-from pyramid.view import view_config
-from zope.interface import implementer
+
+
+__docformat__ = 'restructuredtext'
 
 from pyams_utils import _
 
@@ -123,7 +119,10 @@
     if element is None:
         raise NotFound()
     setattr(element, attribute_name, not getattr(element, attribute_name))
-    return {attribute_name: getattr(element, attribute_name)}
+    return {
+        'status': 'success',
+        attribute_name: getattr(element, attribute_name)
+    }
 
 
 def switch_element_visibility(request, interface, adapter_name=''):