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
2b1af8d8
Commit
2b1af8d8
authored
Feb 05, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added HTTP 1.1/WebDAV status codes
parent
c120f40f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
84 deletions
+64
-84
lib/python/ZPublisher/Response.py
lib/python/ZPublisher/Response.py
+64
-84
No files found.
lib/python/ZPublisher/Response.py
View file @
2b1af8d8
...
@@ -84,8 +84,8 @@
...
@@ -84,8 +84,8 @@
##############################################################################
##############################################################################
'''CGI Response Output formatter
'''CGI Response Output formatter
$Id: Response.py,v 1.4
6 1999/01/13 15:15:20
brian Exp $'''
$Id: Response.py,v 1.4
7 1999/02/05 21:12:47
brian Exp $'''
__version__
=
'$Revision: 1.4
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.4
7
$'
[
11
:
-
2
]
import
string
,
types
,
sys
,
regex
import
string
,
types
,
sys
,
regex
from
string
import
find
,
rfind
,
lower
,
upper
,
strip
,
split
,
join
,
translate
from
string
import
find
,
rfind
,
lower
,
upper
,
strip
,
split
,
join
,
translate
...
@@ -94,88 +94,68 @@ from types import StringType, InstanceType
...
@@ -94,88 +94,68 @@ from types import StringType, InstanceType
nl2sp
=
string
.
maketrans
(
'
\
n
'
,
' '
)
nl2sp
=
string
.
maketrans
(
'
\
n
'
,
' '
)
status_reasons
=
{
status_reasons
=
{
200
:
'OK'
,
100
:
'Continue'
,
201
:
'Created'
,
101
:
'Switching Protocols'
,
202
:
'Accepted'
,
102
:
'Processing'
,
204
:
'No Content'
,
200
:
'OK'
,
300
:
'Multiple Choices'
,
201
:
'Created'
,
301
:
'Moved Permanently'
,
202
:
'Accepted'
,
302
:
'Moved Temporarily'
,
203
:
'Non-Authoritative Information'
,
304
:
'Not Modified'
,
204
:
'No Content'
,
400
:
'Bad Request'
,
205
:
'Reset Content'
,
401
:
'Unauthorized'
,
206
:
'Partial Content'
,
403
:
'Forbidden'
,
207
:
'Multi-Status'
,
404
:
'Not Found'
,
300
:
'Multiple Choices'
,
500
:
'Internal Error'
,
301
:
'Moved Permanently'
,
501
:
'Not Implemented'
,
302
:
'Moved Temporarily'
,
502
:
'Bad Gateway'
,
303
:
'See Other'
,
503
:
'Service Unavailable'
,
304
:
'Not Modified'
,
}
305
:
'Use Proxy'
,
307
:
'Temporary Redirect'
,
status_codes
=
{
400
:
'Bad Request'
,
'ok'
:
200
,
401
:
'Unauthorized'
,
'created'
:
201
,
402
:
'Payment Required'
,
'accepted'
:
202
,
403
:
'Forbidden'
,
'nocontent'
:
204
,
404
:
'Not Found'
,
'multiplechoices'
:
300
,
405
:
'Method Not Allowed'
,
'redirect'
:
300
,
406
:
'Not Acceptable'
,
'movedpermanently'
:
301
,
407
:
'Proxy Authentication Required'
,
'movedtemporarily'
:
302
,
408
:
'Request Time-out'
,
'notmodified'
:
304
,
409
:
'Conflict'
,
'badrequest'
:
400
,
410
:
'Gone'
,
'unauthorized'
:
401
,
411
:
'Length Required'
,
'forbidden'
:
403
,
412
:
'Precondition Failed'
,
'notfound'
:
404
,
413
:
'Request Entity Too Large'
,
'internalerror'
:
500
,
414
:
'Request-URI Too Large'
,
'notimplemented'
:
501
,
415
:
'Unsupported Media Type'
,
'badgateway'
:
502
,
416
:
'Requested range not satisfiable'
,
'serviceunavailable'
:
503
,
417
:
'Expectation Failed'
,
'no content'
:
204
,
422
:
'Unprocessable Entity'
,
'multiple choices'
:
300
,
423
:
'Locked'
,
'moved permanently'
:
301
,
424
:
'Failed Dependency'
,
'moved temporarily'
:
302
,
500
:
'Internal Server Error'
,
'not modified'
:
304
,
501
:
'Not Implemented'
,
'bad request'
:
400
,
502
:
'Bad Gateway'
,
'not found'
:
404
,
503
:
'Service Unavailable'
,
'internal error'
:
500
,
504
:
'Gateway Time-out'
,
'not implemented'
:
501
,
505
:
'HTTP Version not supported'
,
'bad gateway'
:
502
,
507
:
'Insufficient Storage'
,
'service unavailable'
:
503
,
}
200
:
200
,
201
:
201
,
status_codes
=
{}
202
:
202
,
# Add mappings for builtin exceptions and
204
:
204
,
# provide text -> error code lookups.
301
:
301
,
for
key
,
val
in
status_reasons
.
items
():
302
:
302
,
status_codes
[
lower
(
join
(
split
(
val
,
' '
),
''
))]
=
key
304
:
304
,
status_codes
[
lower
(
val
)]
=
key
400
:
400
,
status_codes
[
key
]
=
key
401
:
401
,
en
=
filter
(
lambda
n
:
n
[
-
5
:]
==
'Error'
,
dir
(
__builtins__
))
403
:
403
,
for
name
in
map
(
lower
,
en
):
404
:
404
,
status_codes
[
name
]
=
500
500
:
500
,
status_codes
[
'nameerror'
]
=
503
501
:
501
,
status_codes
[
'keyerror'
]
=
503
502
:
502
,
status_codes
[
'redirect'
]
=
300
503
:
503
,
# Map standard python exceptions to status codes:
'accesserror'
:
500
,
'attributeerror'
:
500
,
'conflicterror'
:
500
,
'eoferror'
:
500
,
'ioerror'
:
500
,
'importerror'
:
500
,
'indexerror'
:
500
,
'keyerror'
:
503
,
'memoryerror'
:
500
,
'nameerror'
:
503
,
'overflowerror'
:
500
,
'runtimeerror'
:
500
,
'syntaxerror'
:
500
,
'systemerror'
:
500
,
'typeerror'
:
500
,
'valueerror'
:
500
,
'zerodivisionerror'
:
500
,
}
end_of_header_search
=
regex
.
compile
(
'</head>'
,
regex
.
casefold
).
search
end_of_header_search
=
regex
.
compile
(
'</head>'
,
regex
.
casefold
).
search
...
...
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