mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Don't patch QPyNullVariant if it doesn't exist
This commit is contained in:
parent
052669f5c5
commit
0fd5fd137f
@ -23,14 +23,17 @@ __copyright__ = '(C) 2007, Martin Dobias'
|
||||
# This will get replaced with a git SHA1 when you do a git archive
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
from PyQt4.QtCore import QPyNullVariant
|
||||
from types import MethodType
|
||||
try:
|
||||
# Add a __nonzero__ method onto QPyNullVariant so we can check for null values easier.
|
||||
# >>> value = QPyNullVariant("int")
|
||||
# >>> if value:
|
||||
# >>> print "Not a null value"
|
||||
from types import MethodType
|
||||
from PyQt4.QtCore import QPyNullVariant
|
||||
def __nonzero__(self):
|
||||
return False
|
||||
|
||||
# Add a __nonzero__ method onto QPyNullVariant so we can check for null values easier.
|
||||
# >>> value = QPyNullVariant("int")
|
||||
# >>> if value:
|
||||
# >>> print "Not a null value"
|
||||
def __nonzero__(self):
|
||||
return False
|
||||
QPyNullVariant.__nonzero__ = MethodType(__nonzero__, None, QPyNullVariant)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
QPyNullVariant.__nonzero__ = MethodType(__nonzero__, None, QPyNullVariant)
|
||||
|
Loading…
x
Reference in New Issue
Block a user