Skip to content

Commit 5f8fa08

Browse files
committed
The valueForKey() method should still work with UserDict since sys.environ is one, for example.
1 parent 61be8d2 commit 5f8fa08

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

MiscUtils/NamedValueAccess.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717

1818
from types import MethodType
19+
from UserDict import UserDict
1920

2021
from MiscUtils import NoDefault
2122

@@ -68,7 +69,7 @@ def valueForKey(obj, key, default=NoDefault):
6869

6970
attr = method = None
7071
unknown = False
71-
if isinstance(obj, dict):
72+
if isinstance(obj, (dict, UserDict)):
7273
if default is NoDefault:
7374
try:
7475
return obj[key]

0 commit comments

Comments
 (0)