Message54877
Please add the following optimizations to the
FieldStorage class in cgi.py:
# =================================================
def keys(self):
"""Dictionary style keys() method."""
if self.list is None:
raise TypeError, "not indexable"
return {}.fromkeys([item.name for item in
self.list]).keys()
def __nonzero__(self):
"""Support for efficient test of instance"""
return self.list and True or False
# =================================================
The __nonzero__ method is new, and keys() method is a
replacement for code which built the list of unique
fields names by hand, and which took several orders of
magnitude longer to perform.
If you need me to post this as a patch against a
certain version, let me know. |
|
Date |
User |
Action |
Args |
2007-08-23 16:12:05 | admin | link | issue1541463 messages |
2007-08-23 16:12:05 | admin | create | |
|