Skip to content

Commit

Permalink
add Python __repr__ method to QgsGeometry.Error (#8198)
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Oct 15, 2018
1 parent 440d8d8 commit 32d4bcc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions python/core/auto_generated/geometry/qgsgeometry.sip.in
Expand Up @@ -1497,6 +1497,12 @@ The coordinates at which the error is located and should be visualized.
True if the location available from :py:func:`where` is valid.
%End

SIP_PYOBJECT __repr__();
%MethodCode
QString str = QStringLiteral( "<QgsGeometry.Error: %1>" ).arg( sipCpp->what() );
sipRes = PyUnicode_FromString( str.toUtf8().data() );
%End

};

enum ValidationMethod
Expand Down
8 changes: 8 additions & 0 deletions src/core/geometry/qgsgeometry.h
Expand Up @@ -1449,6 +1449,14 @@ class CORE_EXPORT QgsGeometry
*/
bool hasWhere() const;

#ifdef SIP_RUN
SIP_PYOBJECT __repr__();
% MethodCode
QString str = QStringLiteral( "<QgsGeometry.Error: %1>" ).arg( sipCpp->what() );
sipRes = PyUnicode_FromString( str.toUtf8().data() );
% End
#endif

private:
QString mMessage;
QgsPointXY mLocation;
Expand Down

0 comments on commit 32d4bcc

Please sign in to comment.