[oe-commits] [bitbake] 20/25: toaster: use 'in' instead of has_key

git at git.openembedded.org git at git.openembedded.org
Fri May 13 16:47:27 UTC 2016


rpurdie pushed a commit to branch python3
in repository bitbake.

commit cd150ddc2f6811af4c1e82c26e326fcb2e93ca44
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Tue May 10 16:27:19 2016 +0300

    toaster: use 'in' instead of has_key
    
    Dictionary method has_key is deprecated in python 2 and absent
    in python 3.
    
    Used '<key> in <dict>' statement to make the code working on
    both python 2 and python 3.
    
    [YOCTO #9584]
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/toaster/toastermain/settings.py | 2 +-
 lib/toaster/toastermain/urls.py     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py
index 8662f39..78702fa 100644
--- a/lib/toaster/toastermain/settings.py
+++ b/lib/toaster/toastermain/settings.py
@@ -321,7 +321,7 @@ currentdir = os.path.dirname(__file__)
 for t in os.walk(os.path.dirname(currentdir)):
     modulename = os.path.basename(t[0])
     #if we have a virtualenv skip it to avoid incorrect imports
-    if os.environ.has_key('VIRTUAL_ENV') and os.environ['VIRTUAL_ENV'] in t[0]:
+    if 'VIRTUAL_ENV' in os.environ and os.environ['VIRTUAL_ENV'] in t[0]:
         continue
 
     if ("views.py" in t[2] or "models.py" in t[2]) and not modulename in INSTALLED_APPS:
diff --git a/lib/toaster/toastermain/urls.py b/lib/toaster/toastermain/urls.py
index 530a42f..1f8599e 100644
--- a/lib/toaster/toastermain/urls.py
+++ b/lib/toaster/toastermain/urls.py
@@ -71,7 +71,7 @@ import os
 currentdir = os.path.dirname(__file__)
 for t in os.walk(os.path.dirname(currentdir)):
     #if we have a virtualenv skip it to avoid incorrect imports
-    if os.environ.has_key('VIRTUAL_ENV') and os.environ['VIRTUAL_ENV'] in t[0]:
+    if 'VIRTUAL_ENV' in os.environ and os.environ['VIRTUAL_ENV'] in t[0]:
         continue
 
     if "urls.py" in t[2] and t[0] != currentdir:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list