diff options
author | André Erdmann <dywi@mailerd.de> | 2014-03-25 21:52:41 +0100 |
---|---|---|
committer | André Erdmann <dywi@mailerd.de> | 2014-03-25 21:52:41 +0100 |
commit | f9997f4e52f70e127432abc01df04c18760fa391 (patch) | |
tree | 7077ee8338378d505cd958629e47745b4b6bb37c /roverlay/overlay | |
parent | fixme note (diff) | |
download | R_overlay-f9997f4e52f70e127432abc01df04c18760fa391.tar.gz R_overlay-f9997f4e52f70e127432abc01df04c18760fa391.tar.bz2 R_overlay-f9997f4e52f70e127432abc01df04c18760fa391.zip |
fix potential python 2 issue
Python 2 checks for __nonzero__(), not __bool__(). roverlay usually relies
explicit checks ("if obj.attr == $expected" or "obj.exists()" rather than
"if object:"), so this is not a major issue.
Diffstat (limited to 'roverlay/overlay')
-rw-r--r-- | roverlay/overlay/additionsdir.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/roverlay/overlay/additionsdir.py b/roverlay/overlay/additionsdir.py index 5e24622..6e795a6 100644 --- a/roverlay/overlay/additionsdir.py +++ b/roverlay/overlay/additionsdir.py @@ -24,7 +24,8 @@ class AdditionsDir ( object ): return self.root is not None and os.path.isdir ( self.root ) # --- end of exists (...) --- - __bool__ = exists + __bool__ = exists + __nonzero__ = exists def iter_entries ( self ): """Generator that yields the directory content of this dir.""" @@ -95,6 +96,10 @@ class _AdditionsDirView ( object ): return bool ( self._additions_dir ) # --- end of __bool__ (...) --- + def __nonzero__ ( self ): + return self.__bool__() + # --- end of __nonzero__ (...) --- + @property def name ( self ): return self._additions_dir.name |