[ python-Feature Requests-1541463 ] Optimizations for cgi.FieldStorage methods

SourceForge.net noreply at sourceforge.net
Wed Aug 16 19:37:21 CEST 2006


Feature Requests item #1541463, was opened at 2006-08-16 13:37
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1541463&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Bob Kline (bkline)
Assigned to: Nobody/Anonymous (nobody)
Summary: Optimizations for cgi.FieldStorage methods

Initial Comment:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1541463&group_id=5470


More information about the Python-bugs-list mailing list