Why is CGI module so complicated?

Mike Fletcher mcfletch at vrtelecom.com
Wed Aug 11 20:03:53 CEST 1999


What about simply adding a __str__ method to these objects?

That way for printing and '%s'%(object) substitution you get the "simple"
response of returning the (likely de-escaped) string value stored in the
field. Similarly, add a "list" method to get the values as a list (possibly
of length one) (is there a special method name that the built-in list
function calls? I could not find it.)

Disclaimer:
	I do not use CGI at all anymore, no idea if this even make sense for
day-to-day operations.

Enjoy yourselves,
Mike


-----Original Message-----
From: python-list-request at cwi.nl [mailto:python-list-request at cwi.nl]On
Behalf Of Michael P. Reilly
Sent: August 10, 1999 1:02 PM
To: python-list at cwi.nl
Subject: Re: Why is CGI module so complicated?


Ian Clarke <I.Clarke at NOSPAM.strs.co.uk> wrote:
: I have been writing an application using the cgi module, and am somewhat
: confused as to why data is returned in FieldStorage or MiniField storage
: objects, why not just return it in a plain dictionary?

: At the moment, lets say you want to access a CGI variable called "pie"
: you need to use:

: f = cgi.FieldStorage()
: print f['pie'].value

: But why not just:

: f = cgi.FieldStorage()
: print f['pie']

: That way the FieldStorage object would be a true dictionary, and could
: be used as, for example, a TemplateDocument's substitutions dictionary.

: I would write a wrapper to get rid of all of the FieldStorage objects,
: but I have almost finished my code :-(

: Can anyone explain what the point of the FieldStorage and
: MiniFieldStorage objects are?

: Ian

Ian, please read my reply in the previous thread:
  http://www.dejanews.com/getdoc.xp/AN=502365247

  -Arcege






More information about the Python-list mailing list