From 8f7d6cd85e68af46648ff93bf846ba95abf7dcee Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Fri, 25 Sep 2009 06:34:34 +0000 Subject: Define __bool__() for compatibility with Python 3. svn path=/main/trunk/; revision=14427 --- pym/portage/proxy/objectproxy.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pym/portage/proxy') diff --git a/pym/portage/proxy/objectproxy.py b/pym/portage/proxy/objectproxy.py index 6dffff7d5..dff4a07f7 100644 --- a/pym/portage/proxy/objectproxy.py +++ b/pym/portage/proxy/objectproxy.py @@ -2,6 +2,8 @@ # Distributed under the terms of the GNU General Public License v2 # $Id$ +import sys + __all__ = ['ObjectProxy'] class ObjectProxy(object): @@ -70,8 +72,11 @@ class ObjectProxy(object): def __ne__(self, other): return object.__getattribute__(self, '_get_target')() != other - def __nonzero__(self): + def __bool__(self): return bool(object.__getattribute__(self, '_get_target')()) + if sys.hexversion < 0x3000000: + __nonzero__ = __bool__ + def __int__(self): return int(object.__getattribute__(self, '_get_target')()) -- cgit v1.2.3-1-g7c22