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