Пример #1
0
    def allow_action(self, action, item_brain):
        """ Return true if the given action is allowed. This is not a
        wrapper for the transition guards of the event workflow. Instead
        it is called *by* the transition guards.

        This allows a number of people to work together on an event website
        with every person having its own group of events which he or she is
        responsible for.

        Per default, only external events may be hidden and only internal
        events archived.

        A client specific packages like izug.seantis.dir.events may
        use a custom adapter to override the default behaviour.
        """
        result = True

        try:
            IExternalEvent(item_brain)
            external_event = True
        except:
            external_event = False

        if external_event:
            if action not in ['hide', 'publish']:
                result = False
        else:
            if action == 'hide':
                result = False

        guard = queryAdapter(self, IActionGuard)
        if guard:
            result = guard.allow_action(action, item_brain)
        return result
Пример #2
0
 def import_source(self):
     try:
         result = IExternalEvent(self.context).source
     except:
         result = ""
     return result