
Untitled
By: a guest on
Apr 24th, 2012 | syntax:
None | size: 0.71 KB | hits: 19 | expires: Never
URI problem in PYQGIS
# create the layer
uri = self.db.getURI()
uri.setDataSource("", "(" + query + ")", geomFieldName, "", uniqueFieldName)
vl = self.iface.addVectorLayer(uri.uri(), newLayerName, self.db.getProviderName())
QApplication.restoreOverrideCursor()
if vl and vl.isValid():
self.saveQuery()
self.accept()
def getURI(self):
# returns a new QgsDataSourceURI instance
return qgis.core.QgsDataSourceURI( self.uri.connectionInfo() )
return qgis.core.QgsDataSourceURI( self.uri.connectionInfo() )
AttributeError: 'NoneType' object has no attribute 'connectionInfo'