diff options
author | 2012-09-09 17:07:18 -0700 | |
---|---|---|
committer | 2012-09-09 17:07:18 -0700 | |
commit | ba259d2ef30a06d5bae4f8044423e58ae0350e60 (patch) | |
tree | 669d586edf904dbeb1835105bd95ac24045407b0 | |
parent | DEVELOPING: fix errors for bug #313413 (diff) | |
download | portage-ba259d2ef30a06d5bae4f8044423e58ae0350e60.tar.gz portage-ba259d2ef30a06d5bae4f8044423e58ae0350e60.tar.bz2 portage-ba259d2ef30a06d5bae4f8044423e58ae0350e60.zip |
ObjectProxy: implement __enter__ and __exit__
-rw-r--r-- | pym/portage/proxy/objectproxy.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/pym/portage/proxy/objectproxy.py b/pym/portage/proxy/objectproxy.py index 92b36d111..a755774ae 100644 --- a/pym/portage/proxy/objectproxy.py +++ b/pym/portage/proxy/objectproxy.py @@ -1,4 +1,4 @@ -# Copyright 2008-2009 Gentoo Foundation +# Copyright 2008-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 import sys @@ -30,6 +30,13 @@ class ObjectProxy(object): result = object.__getattribute__(self, '_get_target')() return result(*args, **kwargs) + def __enter__(self): + return object.__getattribute__(self, '_get_target')().__enter__() + + def __exit__(self, exc_type, exc_value, traceback): + return object.__getattribute__(self, '_get_target')().__exit__( + exc_type, exc_value, traceback) + def __setitem__(self, key, value): object.__getattribute__(self, '_get_target')()[key] = value |