[Python-checkins] CVS: python/nondist/peps pep-0222.txt,1.7,1.8
A.M. Kuchling
python-dev@python.org
Fri, 22 Dec 2000 12:35:22 -0800
Update of /cvsroot/python/python/nondist/peps
In directory usw-pr-cvs1:/tmp/cvs-serv2267
Modified Files:
pep-0222.txt
Log Message:
Fill out the proposed interface some more.
Remove some items that have been taken care of.
Index: pep-0222.txt
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep-0222.txt,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** pep-0222.txt 2000/12/18 03:01:23 1.7
--- pep-0222.txt 2000/12/22 20:35:20 1.8
***************
*** 7,11 ****
Python-Version: 2.1
Created: 18-Aug-2000
! Post-History:
--- 7,11 ----
Python-Version: 2.1
Created: 18-Aug-2000
! Post-History: 22-Dec-2000
***************
*** 22,26 ****
! Proposed Changes
This section lists changes that have been suggested, but about
--- 22,26 ----
! Open Issues
This section lists changes that have been suggested, but about
***************
*** 29,48 ****
be classified as accepted or rejected.
- fcgi.py : A new module adding support for the FastCGI protocol.
- Robin Dunn's code needs to be ported to Windows, though.
-
- Better debugging support for CGIs from the Unix command line.
- Using Perl's CGI.pm [1], if you run a script from the command
- line, you can enter name=value pairs on standard input.
- cgimodel [2] provides this already.
-
- Should the existing cgi.py be deprecated and everything moved into
- a 'web' or 'cgi' package? That would allow removing some
- backward-compatibility cruft.
-
- cgi.py: keep_blank_values should be on by default. The 'if
- form.has_key()/if form[key].value' nested syntax is unnecessarily
- convoluted.
-
cgi.py: We should not be told to create our own subclass just so
we can handle file uploads. As a practical matter, I have yet to
--- 29,32 ----
***************
*** 53,76 ****
with its __init__ call and associated overhead.
- cgi.py: Ideally, the pseudo-dictionary syntax would go away. It
- seems to me that the main reason it is there is to accomodate
-
- form['field'].file syntax. How about the following:
- form['field'] = '' #no values for key
- form['field'] = 'string' #one value in submission for key
- form['field'] = ['string', 'string', ....] #multiple values
- form['field'] = {'fileName':'remote/path',
- 'binaryValue':'@UIHJBV29489erht...'} #one file
- form['field'] = [{'fileName':'remote/path',
- 'binaryValue':'@UIHJBV29489erht...'},
- {'fileName':'another/path',
- 'binaryValue':'7r7w7@@@@'}] #multiple files
-
- cgi.py: I'd prefer "input" or "submission" for the suggested
- FieldStorage() name. The html page into which the data represented
- by FieldStorage() is input is commonly known as a "form", which
- means that when someone refers to "the form" you aren't always
- sure what they are talking about.
-
cgi.py: Currently, query data with no `=' are ignored. Even if
keep_blank_values is set, queries like `...?value=&...' are
--- 37,40 ----
***************
*** 82,88 ****
Utility function: build a query string from a list of 2-tuples
- Higher-level frameworks: add something like Webware or Zope's
- HTTPReqest/HTTPResponse objects.
-
Dictionary-related utility classes: NoKeyErrors (returns an empty
string, never a KeyError), PartialStringSubstitution (returns
--- 46,49 ----
***************
*** 96,99 ****
--- 57,62 ----
that should be added to the Python standard library.
+ * fcgi.py : A new module adding support for the FastCGI protocol.
+ Robin Dunn's code needs to be ported to Windows, though.
Major Changes to Existing Modules
***************
*** 103,107 ****
section therefore carry greater degrees of risk, either in
introducing bugs or a backward incompatibility.
!
Minor Changes to Existing Modules
--- 66,72 ----
section therefore carry greater degrees of risk, either in
introducing bugs or a backward incompatibility.
!
! The cgi.py module would be deprecated. (XXX A new module or
! package name hasn't been chosen yet: 'web'? 'cgilib'?)
Minor Changes to Existing Modules
***************
*** 133,144 ****
Proposed Interface
! XXX open issues: naming convention (studlycaps or underline-separated?);
! no interface for file uploads yet; need to look at all the various
! packages to see if there's anything else missing; need to look at
! the cgi.parse*() functions and see if they can be simplified, too.
! XXX file uploads
!
! Parsing functions: carry over most of the parse* functions from cgi.py
# The Response class borrows most of its methods from Zope's
--- 98,107 ----
Proposed Interface
! 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.
! Parsing functions: carry over most of the parse* functions from
! cgi.py
# The Response class borrows most of its methods from Zope's
***************
*** 169,178 ****
def setCookie(self, name, value,
! path = XXX, # What to use as defaults?
! comment = XXX,
! domain = XXX,
! max-age = XXX,
! expires = XXX,
! secure = XXX
):
"Set a cookie"
--- 132,141 ----
def setCookie(self, name, value,
! path = '/',
! comment = None,
! domain = None,
! max-age = None,
! expires = None,
! secure = 0
):
"Set a cookie"
***************
*** 195,199 ****
pass
! # XXX methods for specific classes of error:serverError, badRequest, etc.?
--- 158,163 ----
pass
! # XXX methods for specific classes of error:serverError,
! # badRequest, etc.?
***************
*** 201,213 ****
"""
! Attributes:
.headers : dictionary containing HTTP headers
.cookies : dictionary of cookies
! .form : data from the form
.env : environment dictionary
"""
def __init__(self, environ=os.environ, stdin=sys.stdin,
! keep_blank_values=0, strict_parsing=0):
"""Initialize the request object, using the provided environment
and standard input."""
--- 165,179 ----
"""
! 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
"""
def __init__(self, environ=os.environ, stdin=sys.stdin,
! keep_blank_values=1, strict_parsing=0):
"""Initialize the request object, using the provided environment
and standard input."""
***************
*** 222,231 ****
def getField(self, name, default=None):
pass
!
def getURL(self, n=0, query_string=0):
"""Return the URL of the current request, chopping off 'n' path
components from the right. Eg. if the URL is
! "http://foo.com/bar/baz/qux", n=2 would return
"http://foo.com/bar". Does not include the query string (if
any)
--- 188,205 ----
def getField(self, name, default=None):
+ "Return field's value as a string (even if it's an uploaded file)"
pass
!
! def getUploadedFile(self, name):
! """Returns a file object that can be read to obtain the contents
! of an uploaded file. XXX should this report an error if the
! field isn't actually an uploaded file? Or should it wrap
! a StringIO around simple fields for consistency?
! """
!
def getURL(self, n=0, query_string=0):
"""Return the URL of the current request, chopping off 'n' path
components from the right. Eg. if the URL is
! "http://foo.com/bar/baz/quux", n=2 would return
"http://foo.com/bar". Does not include the query string (if
any)
***************
*** 247,251 ****
pass
! # Possibilities?
def getBrowser(self):
"Returns Mozilla/IE/Lynx/Opera/whatever"
--- 221,226 ----
pass
! # Possibilities? I don't know if these are worth doing in the
! # basic objects.
def getBrowser(self):
"Returns Mozilla/IE/Lynx/Opera/whatever"
***************
*** 254,259 ****
"Return true if this is an SSLified request"
!
! def wrapper(func, logfile=None):
"""
Calls the function 'func', passing it the arguments
--- 229,235 ----
"Return true if this is an SSLified request"
!
! # Module-level function
! def wrapper(func, logfile=sys.stderr):
"""
Calls the function 'func', passing it the arguments
***************
*** 261,265 ****
sent to the file 'logfile'.
"""
! pass
--- 237,244 ----
sent to the file 'logfile'.
"""
! # This wrapper will detect if it's being called from the command-line,
! # and if so, it will run in a debugging mode; name=value pairs
! # can be entered on standard input to set field values.
! # (XXX how to do file uploads in this syntax?)
***************
*** 267,277 ****
This document has been placed in the public domain.
-
-
- References and Footnotes
-
- [1] CGI.pm:
-
- [2] http://www.embl-heidelberg.de/~chenna/pythonpages/
--- 246,249 ----