[Qgis-developer] attributeMap vs. attributes

Nathan Woodrow madmanwoo at gmail.com
Tue Feb 19 03:38:18 PST 2013


To answer the question of why it was changed.  I was changed because
attributes() is now a list not a map like before when it was called
attributeMap().  You no longer have to do the index look up and just just
do [index] or [name].

- Nathan


On Tue, Feb 19, 2013 at 9:06 PM, Sandro Santilli <strk at keybit.net> wrote:

> On Tue, Feb 19, 2013 at 08:54:55PM +1000, Nathan Woodrow wrote:
> > Why not just hide it using Python method overriding:
> >
> > QgsVectorLayer.attributeMap = QgsVectorLayer.attributes
> >
> > Then you can just call attributesMap()[] and it will call
> > QgsVectorLayer.attributes for you.
>
> I guess you meant QgsFeature.
> Didn't work, anyway:
>
> line 102, in doRemEdgeModFace
>     edge_id = feature.attributeMap()[edge_id_fno].toInt()[0]
> TypeError: QgsFeature.attributes(): first argument of unbound method must
> have type 'QgsFeature'
>
> is attributes() a free function rather than a method ?
>
> --strk;
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130219/269525e5/attachment.html>


More information about the Qgis-developer mailing list