Exemplo n.º 1
0
    def validate(self, target, adding=False):
        if target is None:
            return errors.EmptyInvalidTarget()
        if IGhostAware.providedBy(target):
            return errors.GhostInvalidTarget()
        # Check for cicular reference. You cannot select an ancestor
        # or descandant of the ghost (or the ghost)
        target_path = target.getPhysicalPath()
        if adding:
            test_path = self.container.getPhysicalPath()
        else:
            test_path = self.ghost.getPhysicalPath()

        # XXX !!!!
        if not adding and len(target_path) > len(test_path):
            if test_path == target_path[:len(test_path)]:
                return errors.CircularInvalidTarget()
        elif target_path == test_path[:len(target_path)]:
            return errors.CircularInvalidTarget()
Exemplo n.º 2
0
    def validate(self, target, adding=False):
        if target is None:
            return errors.EmptyInvalidTarget()
        if IGhostAware.providedBy(target):
            return errors.GhostInvalidTarget()
        # Check for cicular reference. You cannot select an ancestor
        # or descandant of the ghost (or the ghost)
        target_path = target.getPhysicalPath()
        if adding:
            test_path = self.container.getPhysicalPath()
        else:
            test_path = self.ghost.getPhysicalPath()

        # XXX !!!!
        if not adding and len(target_path) > len(test_path):
            if test_path == target_path[:len(test_path)]:
                return errors.CircularInvalidTarget()
        elif target_path == test_path[:len(target_path)]:
                return errors.CircularInvalidTarget()
Exemplo n.º 3
0
 def modify(self, target, identifier=None):
     if identifier is None:
         identifier = target.getId()
     if IGhostAware.providedBy(target):
         target = target.get_haunted()
     return self.manipulator(self, target, identifier)
Exemplo n.º 4
0
 def modify(self, target, identifier=None):
     if identifier is None:
         identifier = target.getId()
     if IGhostAware.providedBy(target):
         target = target.get_haunted()
     return self.manipulator(self, target, identifier)
Exemplo n.º 5
0
 def available(self):
     return not IGhostAware.providedBy(self.content)