summaryrefslogtreecommitdiffstats
path: root/Lib/cgi.py
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2007-09-20 18:22:40 (GMT)
committerThomas Wouters <thomas@python.org>2007-09-20 18:22:40 (GMT)
commit8ce81f767a48e9e645c523137c7f83e49f79f986 (patch)
tree68e5fa3f61af5f75d43de717a0c997db77dd2910 /Lib/cgi.py
parent7ce29ca41cd2c41ac7a5981d182f8db25c2af977 (diff)
downloadcpython-8ce81f767a48e9e645c523137c7f83e49f79f986.zip
cpython-8ce81f767a48e9e645c523137c7f83e49f79f986.tar.gz
cpython-8ce81f767a48e9e645c523137c7f83e49f79f986.tar.bz2
Merged revisions 58211-58220 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r58211 | facundo.batista | 2007-09-19 19:53:25 +0200 (Wed, 19 Sep 2007) | 4 lines Issue #1772851. Optimization of __hash__ to behave better for big big numbers. ........ r58216 | raymond.hettinger | 2007-09-20 05:03:43 +0200 (Thu, 20 Sep 2007) | 1 line Fit nits ........ r58217 | georg.brandl | 2007-09-20 10:44:59 +0200 (Thu, 20 Sep 2007) | 2 lines alternate -> alternative. ........ r58218 | georg.brandl | 2007-09-20 18:06:07 +0200 (Thu, 20 Sep 2007) | 2 lines Patch #1541463: optimize performance of cgi.FieldStorage operations. ........ r58219 | georg.brandl | 2007-09-20 18:45:27 +0200 (Thu, 20 Sep 2007) | 2 lines #1176: document that string methods don't take keyword args. ........ r58220 | thomas.wouters | 2007-09-20 19:35:10 +0200 (Thu, 20 Sep 2007) | 4 lines Try harder to stay within the 79-column limit. There's still two places that go (way) over, but those are harder to fix without suffering in readability. ........
Diffstat (limited to 'Lib/cgi.py')
-rwxr-xr-xLib/cgi.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/Lib/cgi.py b/Lib/cgi.py
index 7b457cc..cb92cfc 100755
--- a/Lib/cgi.py
+++ b/Lib/cgi.py
@@ -604,23 +604,21 @@ class FieldStorage:
"""Dictionary style keys() method."""
if self.list is None:
raise TypeError("not indexable")
- keys = []
- for item in self.list:
- if item.name not in keys: keys.append(item.name)
- return keys
+ return list(set(item.name for item in self.list))
def __contains__(self, key):
"""Dictionary style __contains__ method."""
if self.list is None:
raise TypeError("not indexable")
- for item in self.list:
- if item.name == key: return True
- return False
+ return any(item.name == key for item in self.list)
def __len__(self):
"""Dictionary style len(x) support."""
return len(self.keys())
+ def __nonzero__(self):
+ return bool(self.list)
+
def read_urlencoded(self):
"""Internal: read data in query string format."""
qs = self.fp.read(self.length)