def __call__(self): if anon(): raise Unauthorized, u'Not authenticated' return DETAILS % { 'id': self.uid, 'details': self.details(), }
def execute(self): if anon(): raise Unauthorized, u'Not authenticated' name = self.request.get(u'name', u'') uid = self.uid context = self._execution_context() if not context: msg = _(u'Object not found. Could not continue.') return json.dumps({ 'err': True, 'msg': self.context.translate(msg), }) err = False ret_uid = None try: toadapt = (context, self.request) msg, ret_uid = getMultiAdapter(toadapt, IAction, name=name)() if ret_uid is None: ret_uid = uid except ComponentLookupError, e: err = True msg = _(u'No such action: ${name} for ${uid}.', mapping={ u'name': name, u'uid': uid, }) msg = self.context.translate(msg)
def actionInfo(self): if anon(): raise Unauthorized, u'Not authenticated' context = self._execution_context() data = dict() actions = list(getAdapters((context, self.request), IAction)) for id, action in actions: data[id] = { 'enabled': action.enabled, 'url': action.url, 'ajax': action.ajax, } return json.dumps(data)
def show(self): return not anon()
def update(self): self.show = not anon()