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 <tbabej@redhat.com>
This commit is contained in:
Petr Viktorin authored and Tomas Babej committed 2015-08-12 18:17:23 +02:00
1 parent 8b88caa110
commit 6a741b51da
14 files changed
+56 -55

No files matched your search

+1 -1
View File
@@ -1148,7 +1148,7 @@ class LogManager(object):
stream = cfg.get("stream")
log_handler = cfg.get("log_handler")
if filename:
if cfg.has_key("stream"):
if "stream" in cfg:
raise ValueError("both filename and stream are specified, must be one or the other, config: %s" % cfg)
path = os.path.abspath(filename)
filemode = cfg.get('filemode', 'a')