mirror of
https://github.com/python/cpython.git
synced 2025-08-28 12:45:07 +00:00
cgi: use isinstance(x, list) instead of type(x) == type([])
This commit is contained in:
parent
5c23b8e6ea
commit
f1c7ca93c1
1 changed files with 3 additions and 3 deletions
|
@ -582,7 +582,7 @@ class FieldStorage:
|
||||||
"""Dictionary style get() method, including 'value' lookup."""
|
"""Dictionary style get() method, including 'value' lookup."""
|
||||||
if key in self:
|
if key in self:
|
||||||
value = self[key]
|
value = self[key]
|
||||||
if type(value) is type([]):
|
if isinstance(value, list):
|
||||||
return [x.value for x in value]
|
return [x.value for x in value]
|
||||||
else:
|
else:
|
||||||
return value.value
|
return value.value
|
||||||
|
@ -593,7 +593,7 @@ class FieldStorage:
|
||||||
""" Return the first value received."""
|
""" Return the first value received."""
|
||||||
if key in self:
|
if key in self:
|
||||||
value = self[key]
|
value = self[key]
|
||||||
if type(value) is type([]):
|
if isinstance(value, list):
|
||||||
return value[0].value
|
return value[0].value
|
||||||
else:
|
else:
|
||||||
return value.value
|
return value.value
|
||||||
|
@ -604,7 +604,7 @@ class FieldStorage:
|
||||||
""" Return list of received values."""
|
""" Return list of received values."""
|
||||||
if key in self:
|
if key in self:
|
||||||
value = self[key]
|
value = self[key]
|
||||||
if type(value) is type([]):
|
if isinstance(value, list):
|
||||||
return [x.value for x in value]
|
return [x.value for x in value]
|
||||||
else:
|
else:
|
||||||
return [value.value]
|
return [value.value]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue