<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Yes exactly<br>
    <br>
                f = QgsFeature()<br>
                iter = vectorLayer.getFeatures( QgsFeatureRequest() )<br>
                while iter.nextFeature( f ):<br>
                    print f.id()<br>
                    f.setAttribute( field, QVariant( 1 ) )<br>
                    vectorLayer.updateFeature( f )<br>
    <br>
    Prints only 1 id, commenting the last line prints all ids.<br>
    <br>
    On 03/22/2013 01:56 PM, Nathan Woodrow wrote:<br>
    <blockquote
cite="mid:CAAi8Yg8i2FFYhr1Ab4hYOoJLeobvvGAW8Fy24FFoaZtE1AjREg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Do you mean your loop is exited when you call
        updateFeature?
        <div><br>
        </div>
        <div style="">Can you post your code.</div>
        <div style=""><br>
        </div>
        <div style="">- Nathan</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">
          On Fri, Mar 22, 2013 at 10:54 PM, Denis Rouzaud <span
            dir="ltr"><<a moz-do-not-send="true"
              href="mailto:denis.rouzaud@gmail.com" target="_blank">denis.rouzaud@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            Hi all,<br>
            <br>
            I am looping over features of a layer using new API
            (QgsFeatureRequest).<br>
            If I modify a feature and do: layer.updateFeature(f), my
            loop is broken.<br>
            Is this a normal behavior?<br>
            <br>
            What should I do if I want to modify features during the
            loop?<br>
            <br>
            Thanks<br>
            <br>
            Denis<br>
            _______________________________________________<br>
            Qgis-developer mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:Qgis-developer@lists.osgeo.org"
              target="_blank">Qgis-developer@lists.osgeo.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.osgeo.org/mailman/listinfo/qgis-developer"
              target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </body>
</html>