示例#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()
示例#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()
示例#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)
示例#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)
示例#5
0
 def available(self):
     return not IGhostAware.providedBy(self.content)