Menu

#145 Add a context manager for registry.Value

open
nobody
None
4
2012-12-31
2012-12-26
No

Hi,

This is sometimes useful in tests (or even in plugins) to temporaly edit a config variable, then reset it to its previous value.
This commit provides a context manager (ie. objects used by the 'with' statement) to do it.

Here is the code itself: https://github.com/ProgVal/Limnoria/commit/4e8c35dd0c76bdf4b65e942596e68c4e41ae28df
And a patch to the Channel plugin, which uses it: https://github.com/ProgVal/Limnoria/commit/3063340ce3c3bacd57df0e5ec479db1fca4521a2

As you can see, plugin developpers no longer have to store it, nor to use try..finally statements.

Regards,
Valentin

Discussion


Log in to post a comment.