Skip to content

QgsLayoutExporter.exportToPdf() does not have the same return value type if an iterator is passed or not #62501

Description

@nicogodet

What is the bug or the crash?

See both doc for QgsLayoutExporter.exportToPdf(): https://qgis.org/pyqgis/master/core/QgsLayoutExporter.html#qgis.core.QgsLayoutExporter.exportToPdf

If no iterator is passed, the return value of QgsLayoutExporter.exportToPdf() is a member of QgsLayoutExporter.ExportResult and in case of error, error is not returned

but if an iterator is passed, the return value is a tuple (int / QgsLayoutExporter.ExportResult, str)

By consistency, it would be worth to return QgsLayoutExporter.ExportResult in both cases or a tuple but mixed type is confusing

Steps to reproduce the issue

.

Versions

3.42.3 but doc of 3.42.3 and master is the same.

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugEither a bug report, or a bug fix. Let's hope for the latter!Print LayoutsRelated to QGIS Print Layouts, Atlas or Reporting frameworksPyQGISRelated to the PyQGIS API

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions