def __call__(self, action_name): #get action instance action = get_action_class(action_name)(self.context) #call instance with params result = action(**self.get_args_from_request(action_name)) or {} result.update(get_image_information(action.editor)) result['previous_action'] = action_name resp = self.request.response resp.setHeader('Cache-Control', 'no-cache') resp.setHeader('Pragma', 'no-cache') return json(result)
def setup_js(self): setup_js = [] for name, action in self.actions: js = action.on_setup() if js: setup_js.append(js) return """ var IMAGE_INFORMATION = %s; (function($){ $(document).ready(function(){ %s }); })(jQuery); """ % (json(get_image_information(self.editor)), '\n'.join(setup_js))