Beispiel #1
0
    def _is_valid_dest(self, dest):
        """
        Check if the test argument is valid
        """
        result = True

        if not dest.is_dir():
            self.errors.add(
                error.NoSuchDirectoryToSubcmdInto(self.subcmd, dest))
            result = False
        else:
            if not utils.is_directory_writable(dest):
                self.errors.add(
                    error.InsufficientPermissionsToSubcmdTo(self.subcmd, dest))
                result = False

            if not utils.is_directory_readable(dest):
                self.errors.add(
                    error.InsufficientPermissionsToSubcmdTo(self.subcmd, dest))
                result = False

            if not utils.is_directory_executable(dest):
                self.errors.add(
                    error.InsufficientPermissionsToSubcmdTo(self.subcmd, dest))
                result = False

        return result
Beispiel #2
0
    def _is_valid_source(self, source):
        if not source.exists():
            self.errors.add(error.NoSuchFileOrDirectory(self.subcmd, source))
            return False

        elif (not utils.is_file_readable(source)
              or not utils.is_directory_readable(source)):
            self.errors.add(error.InsufficientPermissions(self.subcmd, source))
            return False

        return True
Beispiel #3
0
    def _is_valid_source(self, source):
        if not source.exists():
            self.errors.add(error.NoSuchFileOrDirectory(self.subcmd, source))
            return False

        elif (not utils.is_file_readable(source)
              or not utils.is_directory_readable(source)):
            self.errors.add(error.InsufficientPermissions(self.subcmd, source))
            return False

        return True
Beispiel #4
0
    def _is_valid_source(self, source):
        """
        Check if the source argument is valid
        """
        result = True

        if not source.is_dir():
            self.errors.add(error.NoSuchDirectory(self.subcmd, source))
            result = False
        else:
            if not utils.is_directory_readable(source):
                self.errors.add(
                    error.InsufficientPermissionsToSubcmdFrom(
                        self.subcmd, source))
                result = False

            if not utils.is_directory_executable(source):
                self.errors.add(
                    error.InsufficientPermissionsToSubcmdFrom(
                        self.subcmd, source))
                result = False

        return result