Skip to content

Commit

Permalink
Add != (not equal) support to python NULL value
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 30, 2013
1 parent 1433f3c commit 4db6396
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/__init__.py
Expand Up @@ -49,9 +49,13 @@ def __repr__(self):
def __eq__(self, other):
return isinstance(other, QPyNullVariant) or other is None

def __ne__(self, other):
return not isinstance(other, QPyNullVariant) and other is not None

QPyNullVariant.__nonzero__ = MethodType(__nonzero__, None, QPyNullVariant)
QPyNullVariant.__repr__ = MethodType(__repr__, None, QPyNullVariant)
QPyNullVariant.__eq__= MethodType(__eq__, None, QPyNullVariant)
QPyNullVariant.__ne__= MethodType(__ne__, None, QPyNullVariant)

# define a dummy QPyNullVariant instance NULL in qgis.core
# this is mainly used to compare against
Expand Down

0 comments on commit 4db6396

Please sign in to comment.