Skip to content
Permalink
Browse files

Fix sip API reseting to version 1 (fixes PyQgs* tests currently faili…

…ng due to reset)
  • Loading branch information
dakcarto committed Sep 25, 2013
1 parent a17787b commit 8b6d813aee8e810aaa5a202572dabb17e2f4ebab
Showing with 4 additions and 4 deletions.
  1. +4 −4 python/__init__.py
@@ -24,8 +24,6 @@
__revision__ = '$Format:%H$'

import sip
from qgis.core import QgsFeature, QgsGeometry

try:
apis = ["QDate", "QDateTime", "QString", "QTextStream", "QTime", "QUrl", "QVariant"]
for api in apis:
@@ -34,6 +32,8 @@
# API has already been set so we can't set it again.
pass

from qgis.core import QgsFeature, QgsGeometry

try:
# Add a __nonzero__ method onto QPyNullVariant so we can check for null values easier.
# >>> value = QPyNullVariant("int")
@@ -72,15 +72,15 @@ def mapping_feature(feature):
properties = {}
fields = [field.name() for field in feature.fields()]
properties = dict(zip(fields, feature.attributes()))
return {
return {
'type' : 'Feature',
'properties' : properties,
'geometry' : geom.__geo_interface__}

def mapping_geometry(geometry):
geo = geometry.exportToGeoJSON()
# We have to use eval because exportToGeoJSON() gives us
# back a string that looks like a dictionary.
# back a string that looks like a dictionary.
return eval(geo)

QgsFeature.__geo_interface__ = property(mapping_feature)

0 comments on commit 8b6d813

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