Project: QGIS

Version: 2.12.0

Feature: Editing layers via `with edit(layer):`

Example:

 from qgis.core import edit

with edit(layer):
    f=layer.getFeatures().next()
    f[0]=5
    layer.updateFeature(f)

This will automatically call commitChanges() in the end. If any exception occurs, it will rollBack() all the changes.

This feature was developed by: Matthias Kuhn at OpenGIS