Class: QgsProjectServerValidator

Validates the server specific parts of the configuration of a QGIS project.

Added in version 3.14.

Static Methods

displayValidationError

Returns a human readable string for a given error.

validate

Validates a project to detect problems on QGIS Server, and returns True if it's considered valid.

Attributes

DuplicatedNames

LayerEncoding

LayerShortName

ProjectRootNameConflict

ProjectShortName

class qgis.core.QgsProjectServerValidator[source]

Bases: object

DuplicatedNames = 0
LayerEncoding = 2
LayerShortName = 1
ProjectRootNameConflict = 4
ProjectShortName = 3
class ValidationError

Bases: int

class ValidationResult

Bases: object

Contains the parameters describing a project validation failure.

error: ValidationError

Error which occurred during the validation process.

identifier: object

Identifier related to the error. It can be a layer/group name.

static displayValidationError(error: QgsProjectServerValidator.ValidationError) str[source]

Returns a human readable string for a given error.

Parameters:

error (QgsProjectServerValidator.ValidationError) – the error.

Return type:

str

Returns:

the human readable error.

static validate(project: QgsProject | None)[source]

Validates a project to detect problems on QGIS Server, and returns True if it’s considered valid. If validation fails, the results list will be filled with a list of items describing why the validation failed and what needs to be rectified

Parameters:

project (Optional[QgsProject]) -> (bool) – input project to check

Returns:

  • bool

  • results: results of the validation