Commit c51ebf9c authored by Jim Fulton's avatar Jim Fulton

Added :default_method form variable type.

parent e3605d32
...@@ -353,6 +353,10 @@ Function, method, and class objects ...@@ -353,6 +353,10 @@ Function, method, and class objects
Only one method field should be provided. If more than one method Only one method field should be provided. If more than one method
field is included in the request, the behavior is undefined. field is included in the request, the behavior is undefined.
If the name of a form field is ':default_method', then the value
of the field is added to 'PATH_INFO' *if and only if* there are no
form fields with names ending in ':method'.
The base HREF is set when method fields are provided. In the The base HREF is set when method fields are provided. In the
above examples, the base HREF is set to '.../foo/bar/x'. Of above examples, the base HREF is set to '.../foo/bar/x'. Of
course, if, in this example, 'y' was an object with an index_html course, if, in this example, 'y' was an object with an index_html
...@@ -478,11 +482,11 @@ Publishing a module using CGI ...@@ -478,11 +482,11 @@ Publishing a module using CGI
containing the module to be published) to the module name in the containing the module to be published) to the module name in the
cgi-bin directory. cgi-bin directory.
$Id: Publish.py,v 1.102 1998/09/25 15:14:49 jim Exp $""" $Id: Publish.py,v 1.103 1998/10/02 19:42:10 jim Exp $"""
#' #'
# #
########################################################################## ##########################################################################
__version__='$Revision: 1.102 $'[11:-2] __version__='$Revision: 1.103 $'[11:-2]
import sys, os, string, cgi, regex import sys, os, string, cgi, regex
from string import * from string import *
...@@ -556,6 +560,7 @@ class ModulePublisher: ...@@ -556,6 +560,7 @@ class ModulePublisher:
type_search=type_re.search type_search=type_re.search
lt=type([]) lt=type([])
CGI_name=isCGI_NAME CGI_name=isCGI_NAME
meth=None
for item in fslist: for item in fslist:
key=unquote(item.name) key=unquote(item.name)
...@@ -581,15 +586,12 @@ class ModulePublisher: ...@@ -581,15 +586,12 @@ class ModulePublisher:
seqf=tuple seqf=tuple
tuple_items[key]=1 tuple_items[key]=1
elif type_name == 'method': elif type_name == 'method':
if environ.has_key('PATH_INFO'): if l: meth=key
path=environ['PATH_INFO'] else: meth=item
while path[-1:]=='/': path=path[:-1] elif type_name == 'default_method':
else: path='' if not meth:
if l: m=key if l: meth=key
else: m=item else: meth=item
path="%s/%s" % (path,m)
other['PATH_INFO']=path
self._hacked_path=1
else: else:
item=type_converters[type_name](item) item=type_converters[type_name](item)
l=type_search(key) l=type_search(key)
...@@ -614,10 +616,17 @@ class ModulePublisher: ...@@ -614,10 +616,17 @@ class ModulePublisher:
form[key]=item form[key]=item
other[key]=item other[key]=item
if meth:
if environ.has_key('PATH_INFO'):
path=environ['PATH_INFO']
while path[-1:]=='/': path=path[:-1]
else: path=''
other['PATH_INFO']=path="%s/%s" % (path,meth)
self._hacked_path=1
# Cookie values should *not* be appended to existing form # Cookie values should *not* be appended to existing form
# vars with the same name - they are more like default values # vars with the same name - they are more like default values
# for names not otherwise specified in the form. # for names not otherwise specified in the form.
cookies={} cookies={}
if environ.has_key('HTTP_COOKIE'): if environ.has_key('HTTP_COOKIE'):
parse_cookie(self.environ['HTTP_COOKIE'],cookies) parse_cookie(self.environ['HTTP_COOKIE'],cookies)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment