PEP 222 draft

Erno Kuusela erno-news at erno.iki.fi
Sun Dec 24 14:17:50 EST 2000


>>>>> "A" == A M Kuchling <amk at mira.erols.com> writes:

|     The cgi.py module would be deprecated.  (XXX A new module or
| package name hasn't been chosen yet: 'web'?  'cgilib'?)

i would like it more to add the new stuff to the existing cgi module
rather than having old/new modules with slightly different
variations of the same name.

|     XXX open issues: naming convention (studlycaps or
| underline-separated?); need to look at the cgi.parse*() functions
| and see if they can be simplified, too.

StudlyCaps for classes and underline_separated for the rest!

|     # The Response class borrows most of its methods from Zope's #
| HTTPResponse class.


    
|         def redirect(self, url): "Redirect the browser to another
| URL" pass
    
i think this is spurious, there is the status method already,
and you don't know which of the various 30x responses is most
appropriate here.

|         # XXX methods for specific classes of error:serverError, #
| badRequest, etc.?

i like cacheability, maybe expires/last-modified/vary
but maybe that's spurious too.
    
    
|     class Request:
    
|         """ Attributes:

|         XXX should these be dictionaries, or dictionary-like
| objects?  .headers : dictionary containing HTTP headers .cookies :
| dictionary of cookies .fields : data from the form .env :
| environment dictionary """

probably dictionary-like, since there can be several occurrences
of a single header and the order might matter.
        
[...]
    
|         # Should people just use the dictionaries directly?  def
| getHeader(self, name, default=None): pass

"getList" too?

    
|         # Possibilities?  I don't know if these are worth doing in
| the # basic objects.  def getBrowser(self): "Returns
| Mozilla/IE/Lynx/Opera/whatever"

do you mean attempting something more than just returning the
user-agent header? that seems highly unwise to me. many browsers
(opera, konqueror, msie atleast) lie in the user-agent header
and it's not possible to decipher it robustly and future-proofly.
and most of the situations where misguided cgi programmers want to do
user-agent sniffing is exactly differentiating between these.

   -- erno





More information about the Python-list mailing list