Skip to content
Permalink
Browse files

Add != (not equal) support to python NULL value

  • Loading branch information
m-kuhn committed Aug 30, 2013
1 parent 1433f3c commit 4db63969385a5e2f0f3f2b2d787f523883a94407
Showing with 4 additions and 0 deletions.
  1. +4 −0 python/__init__.py
@@ -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

0 comments on commit 4db6396

Please sign in to comment.
You can’t perform that action at this time.