Ejemplo n.º 1
0
 def __call__(self):
     '''  Apply selected layout to a content item
     '''
     obj = self.event.object
     same_as_parent = self.element.same_as_parent
     subject = self.element.subject
     if not (utils.subject_available(obj)):
         return False
     if same_as_parent:
         parent = aq_parent(obj)
         if not (utils.subject_available(parent)):
             return False
         subject = utils.subject_for_object(parent)
     return utils.set_subject(obj, subject)
Ejemplo n.º 2
0
 def __call__(self):
     '''  Apply selected layout to a content item
     '''
     obj = self.event.object
     same_as_parent = self.element.same_as_parent
     subject = self.element.subject
     if not (utils.subject_available(obj)):
         return False
     if same_as_parent:
         parent = aq_parent(obj)
         if not (utils.subject_available(parent)):
             return False
         subject = utils.subject_for_object(parent)
     return utils.set_subject(obj, subject)
Ejemplo n.º 3
0
    def __call__(self):
        expected = self.element.subject
        obj = aq_inner(self.event.object)

        if not (utils.subject_available(obj)):
            return False

        subject = utils.subject_for_object(obj)
        if not expected:
            return not (expected or subject)
        intersection = set(expected).intersection(subject)
        return intersection and True or False