This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bkline
Recipients
Date 2006-08-16.17:37:16
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
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.
History
Date User Action Args
2007-08-23 16:12:05adminlinkissue1541463 messages
2007-08-23 16:12:05admincreate