From 6a741b51dac6efd650f2427604bd54cbf300f761 Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Thu, 30 Jul 2015 17:29:39 +0200 Subject: Replace dict.has_key with the 'in' operator The deprecated has_key method will be removed from dicts in Python 3. For custom dict-like classes, has_key() is kept on Python 2, but disabled for Python 3. Reviewed-By: Tomas Babej --- install/migration/migration.py | 2 +- install/po/pygettext.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'install') diff --git a/install/migration/migration.py b/install/migration/migration.py index e1823e151..05151e66b 100644 --- a/install/migration/migration.py +++ b/install/migration/migration.py @@ -69,7 +69,7 @@ def application(environ, start_response): return wsgi_redirect(start_response, 'index.html') form_data = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ) - if not form_data.has_key('username') or not form_data.has_key('password'): + if 'username' not in form_data or 'password' not in form_data: return wsgi_redirect(start_response, 'invalid.html') # API object only for configuration, finalize() not needed diff --git a/install/po/pygettext.py b/install/po/pygettext.py index 171bd4fc5..6f288ec11 100755 --- a/install/po/pygettext.py +++ b/install/po/pygettext.py @@ -280,7 +280,7 @@ def containsAny(str, set): def _visit_pyfiles(list, dirname, names): """Helper for getFilesForName().""" # get extension for python source files - if not globals().has_key('_py_ext'): + if '_py_ext' not in globals(): global _py_ext _py_ext = [triple[0] for triple in imp.get_suffixes() if triple[2] == imp.PY_SOURCE][0] -- cgit