[QGIS-trac] Re: [Quantum GIS] #1462: PostGIS layer loaded via Python is not saved correct in qgs project file

Quantum GIS qgis at qgis.org
Mon Dec 15 06:32:26 EST 2008


#1462: PostGIS layer loaded via Python is not saved correct in qgs project file
--------------------------------------------------------------+-------------
        Reporter:  hdus                                       |         Owner:  jef          
            Type:  bug                                        |        Status:  new          
        Priority:  critical: causes crash or data corruption  |     Milestone:  Version 1.0.0
       Component:  Project Loading / Saving                   |       Version:  HEAD         
      Resolution:                                             |      Keywords:               
Platform_version:                                             |      Platform:  All          
        Must_fix:  No                                         |   Status_info:  0            
--------------------------------------------------------------+-------------
Comment (by jef):

 I tried to run your code in the python console.  When try to save I get

 {{{
 NotImplementedError: QgsVectorLayer.writeSymbology() is abstract and must
 be overridden
 }}}

 I still need to investigate why there's python code fired at all at that
 point, but if I replace

 {{{
 vlayer = QgsVectorLayer(uri.uri(), layerName, "postgres")
 QgsMapLayerRegistry.instance().addMapLayer(vlayer)
 }}}

 with

 {{{
 iface.addVectorLayer(uri.uri(), layerName, "postgres")
 }}}

 everything is fine again.

-- 
Ticket URL: <http://trac.osgeo.org/qgis/ticket/1462#comment:1>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list