Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
3a82c48f
Commit
3a82c48f
authored
Oct 15, 1996
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tuple argument type and enhances error handling.
parent
b71ff961
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
5 deletions
+23
-5
lib/python/ZPublisher/Publish.py
lib/python/ZPublisher/Publish.py
+23
-5
No files found.
lib/python/ZPublisher/Publish.py
View file @
3a82c48f
...
@@ -261,6 +261,11 @@ Function, method, and class objects
...
@@ -261,6 +261,11 @@ Function, method, and class objects
date -- Date-time values
date -- Date-time values
list -- Python list of values, even if there is only
one value.
tuple -- Python tuple of values, even if there is only one.
For example, if the name of a field in an input
For example, if the name of a field in an input
form is age:int, then the field value will be passed in argument,
form is age:int, then the field value will be passed in argument,
age, and an attempt will be made to convert the argument value to
age, and an attempt will be made to convert the argument value to
...
@@ -517,7 +522,7 @@ Publishing a module using the ILU Requestor (future)
...
@@ -517,7 +522,7 @@ Publishing a module using the ILU Requestor (future)
o Configure the web server to call module_name@server_name with
o Configure the web server to call module_name@server_name with
the requestor.
the requestor.
$Id: Publish.py,v 1.2
0 1996/09/16 14:43:27
jim Exp $"""
$Id: Publish.py,v 1.2
1 1996/10/15 15:45:35
jim Exp $"""
#'
#'
# Copyright
# Copyright
#
#
...
@@ -570,6 +575,9 @@ $Id: Publish.py,v 1.20 1996/09/16 14:43:27 jim Exp $"""
...
@@ -570,6 +575,9 @@ $Id: Publish.py,v 1.20 1996/09/16 14:43:27 jim Exp $"""
# (540) 371-6909
# (540) 371-6909
#
#
# $Log: Publish.py,v $
# $Log: Publish.py,v $
# Revision 1.21 1996/10/15 15:45:35 jim
# Added tuple argument type and enhances error handling.
#
# Revision 1.20 1996/09/16 14:43:27 jim
# Revision 1.20 1996/09/16 14:43:27 jim
# Changes to make shutdown methods work properly. Now shutdown methods
# Changes to make shutdown methods work properly. Now shutdown methods
# can simply sys.exit(0).
# can simply sys.exit(0).
...
@@ -659,7 +667,7 @@ $Id: Publish.py,v 1.20 1996/09/16 14:43:27 jim Exp $"""
...
@@ -659,7 +667,7 @@ $Id: Publish.py,v 1.20 1996/09/16 14:43:27 jim Exp $"""
#
#
#
#
#
#
__version__
=
'$Revision: 1.2
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.2
1
$'
[
11
:
-
2
]
def
main
():
def
main
():
...
@@ -688,7 +696,7 @@ class ModulePublisher:
...
@@ -688,7 +696,7 @@ class ModulePublisher:
raise
'NotFound'
,
self
.
html
(
raise
'NotFound'
,
self
.
html
(
"Resource not found"
,
"Resource not found"
,
"Sorry, the requested document does not exist.<p>"
"Sorry, the requested document does not exist.<p>"
"
\
n
<!--
\
n
%s
\
n
-->"
%
entry
)
"
\
n
<!--
\
n
%s
\
n
-->"
%
entry
)
,
sys
.
exc_traceback
forbiddenError
=
notFoundError
# If a resource is forbidden,
forbiddenError
=
notFoundError
# If a resource is forbidden,
# why reveal that it exists?
# why reveal that it exists?
...
@@ -870,8 +878,13 @@ class ModulePublisher:
...
@@ -870,8 +878,13 @@ class ModulePublisher:
except
:
pass
except
:
pass
try
:
try
:
request_params
=
getattr
(
subobject
,
'__request_data__'
)
request_params
=
getattr
(
subobject
,
'__request_data__'
)
# bleh, test gets around Python bug:
if
not
(
type
(
request_params
)
is
types
.
MethodType
and
type
(
subobject
)
is
types
.
ClassType
):
try
:
request_params
=
request_params
()
try
:
request_params
=
request_params
()
except
:
pass
except
:
pass
for
key
in
request_params
.
keys
():
for
key
in
request_params
.
keys
():
self
.
request
[
key
]
=
request_params
[
key
]
self
.
request
[
key
]
=
request_params
[
key
]
except
:
pass
except
:
pass
...
@@ -1138,6 +1151,10 @@ def field2list(v):
...
@@ -1138,6 +1151,10 @@ def field2list(v):
if
type
(
v
)
is
not
types
.
ListType
:
v
=
[
v
]
if
type
(
v
)
is
not
types
.
ListType
:
v
=
[
v
]
return
v
return
v
def
field2tuple
(
v
):
if
type
(
v
)
is
not
types
.
ListType
:
v
=
(
v
,)
return
tuple
(
v
)
class
Request
:
class
Request
:
"""
\
"""
\
Model HTTP request data.
Model HTTP request data.
...
@@ -1239,6 +1256,7 @@ class Request:
...
@@ -1239,6 +1256,7 @@ class Request:
'string'
:
field2string
,
'string'
:
field2string
,
'date'
:
field2date
,
'date'
:
field2date
,
'list'
:
field2list
,
'list'
:
field2list
,
'tuple'
:
field2tuple
,
'regex'
:
field2regex
,
'regex'
:
field2regex
,
'Regex'
:
field2Regex
,
'Regex'
:
field2Regex
,
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment