Inconsistency in CGI Documentation????

Maan M. Hamze mmhamze at
Fri Aug 24 16:53:53 CEST 2001

Thanks for the wealth of information you provided.
"Sam Penrose" <sam at> wrote in message
news:mailman.998430691.1919.python-list at
>This requires (?) wrapping FieldStorage. Chuck Esterbrook did so for
> in a class called HTTPRequest:

I had a look at this before.  But since this was my first CGI Python
project, I wanted to be familiar with what came with Python before moving
into investigating other packages.

> I used that as the basis of my own, much simpler (and cruder) wrapper
> class which I am happy to share if anyone wants it.

Can I have a look at it?

> 2) If you think that all of this is an indictment of the current Python
> library, you're right. The BDFL does not seem to agree, however. I spent
> considerable time thinking about writing a replacement for the
> FieldStorage class, but foundered when I realized how little I knew
> about why it used recursive object-birthing to parse MIME headers:
>     FieldStorageClass = None
>     def read_multi(self, environ, keep_blank_values, strict_parsing):
>         """Internal: read a part that is itself multipart."""
>         self.list = []
>         klass = self.FieldStorageClass or self.__class__
>         part = klass(self.fp, {}, self.innerboundary,
>                      environ, keep_blank_values, strict_parsing)
>         # Throw first part away
>         while not part.done:
>             headers = rfc822.Message(self.fp)
>             part = klass(self.fp, headers, self.innerboundary,
>                          environ, keep_blank_values, strict_parsing)
>             self.list.append(part)
>         self.skip_lines()
> If someone can help me get past that, I might take another whack at it.
> In particular, I'm not sure whether the recursion is important for
> avoiding N^2 worst-case performance, or whether it's just the nifty
> kind of thing you do if you are as smart as Guido.

Well, any takers for these questions?

More information about the Python-list mailing list