<div dir="ltr">Personally I'm not a fan of that.<div><br></div><div style>Why don't we make startEditing() return a edit buffer/edit session. So you could do this:</div><div style><br></div><div style>session = layer.editSession()</div>

<div style>session.addFeature(feature)</div><div style>...</div><div style>session.commitChanges()</div><div style><br></div><div style>This would mean that everyone can keep their own edit buffers and can do what they want.  Means you could also doing this:</div>

<div style><br></div><div style>with layer.editSession() as session:</div><div style>     session.addFeature(...)</div><div style><br></div><div style>which will commit the features at the end.</div><div style><br></div>
<div style>
- Nathan</div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Apr 16, 2013 at 4:10 PM, Martin Dobias <span dir="ltr"><<a href="mailto:wonder.sk@gmail.com" target="_blank">wonder.sk@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Apr 16, 2013 at 12:53 AM, Nathan Woodrow <<a href="mailto:madmanwoo@gmail.com">madmanwoo@gmail.com</a>> wrote:<br>


> What would be the API calls in order to add a new feature to a layer and<br>
> commit the result?<br>
<br>
</div>layer.startEditing()<br>
layer.editBuffer().addFeature( feature )<br>
layer.commitChanges()<br>
<br>
Anyway if someone wants to add a new feature permanently, it should be<br>
rather done this way:<br>
layer.dataProvider().addFeatures( [feature] )<br>
It's more efficient and it does not mess with the editing state of the<br>
layer (imagine you are editing a layer and a plugin action will commit<br>
all your changes without asking!).<br>
<span class="HOEnZb"><font color="#888888"><br>
Martin<br>
</font></span></blockquote></div><br></div>