Beispiel #1
0
 def __call__(self):
     if anon():
         raise Unauthorized, u'Not authenticated'
     return DETAILS % {
         'id': self.uid,
         'details': self.details(),
     }
Beispiel #2
0
 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)
Beispiel #3
0
 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)
Beispiel #4
0
 def show(self):
     return not anon()
Beispiel #5
0
 def update(self):
     self.show = not anon()