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
d5d72e9a
Commit
d5d72e9a
authored
Sep 08, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup and make base request/response new-style classes.
parent
debe7079
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
10 deletions
+10
-10
src/ZPublisher/BaseRequest.py
src/ZPublisher/BaseRequest.py
+1
-1
src/ZPublisher/BaseResponse.py
src/ZPublisher/BaseResponse.py
+8
-8
src/ZPublisher/HTTPResponse.py
src/ZPublisher/HTTPResponse.py
+1
-1
No files found.
src/ZPublisher/BaseRequest.py
View file @
d5d72e9a
...
@@ -179,7 +179,7 @@ class DefaultPublishTraverse(object):
...
@@ -179,7 +179,7 @@ class DefaultPublishTraverse(object):
return
self
.
context
,
()
return
self
.
context
,
()
class
BaseRequest
:
class
BaseRequest
(
object
)
:
"""Provide basic ZPublisher request management
"""Provide basic ZPublisher request management
This object provides access to request data. Request data may
This object provides access to request data. Request data may
...
...
src/ZPublisher/BaseResponse.py
View file @
d5d72e9a
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
from
zExceptions
import
Unauthorized
,
Forbidden
,
NotFound
,
BadRequest
from
zExceptions
import
Unauthorized
,
Forbidden
,
NotFound
,
BadRequest
class
BaseResponse
:
class
BaseResponse
(
object
)
:
"""Base Response Class
"""Base Response Class
"""
"""
debug_mode
=
None
debug_mode
=
None
...
@@ -59,7 +59,7 @@ class BaseResponse:
...
@@ -59,7 +59,7 @@ class BaseResponse:
return
self
.
status
return
self
.
status
def
setCookie
(
self
,
name
,
value
,
**
kw
):
def
setCookie
(
self
,
name
,
value
,
**
kw
):
'''
\
'''
Set an HTTP cookie on the browser
Set an HTTP cookie on the browser
The response will include an HTTP header that sets a cookie on
The response will include an HTTP header that sets a cookie on
...
@@ -80,12 +80,13 @@ class BaseResponse:
...
@@ -80,12 +80,13 @@ class BaseResponse:
self
.
setBody
(
self
.
getBody
()
+
body
)
self
.
setBody
(
self
.
getBody
()
+
body
)
def
getHeader
(
self
,
name
):
def
getHeader
(
self
,
name
):
'''
\
'''
Get a header value
Get a header value
Returns the value associated with a HTTP return header, or
Returns the value associated with a HTTP return header, or
"None" if no such header has been set in the response
"None" if no such header has been set in the response
yet. '''
yet.
'''
return
self
.
headers
.
get
(
name
,
None
)
return
self
.
headers
.
get
(
name
,
None
)
def
__getitem__
(
self
,
name
):
def
__getitem__
(
self
,
name
):
...
@@ -106,7 +107,7 @@ class BaseResponse:
...
@@ -106,7 +107,7 @@ class BaseResponse:
pass
pass
def
write
(
self
,
data
):
def
write
(
self
,
data
):
"""
\
"""
Return data as a stream
Return data as a stream
HTML data may be returned using a stream-oriented interface.
HTML data may be returned using a stream-oriented interface.
...
@@ -118,7 +119,6 @@ class BaseResponse:
...
@@ -118,7 +119,6 @@ class BaseResponse:
Note that published objects must not generate any errors
Note that published objects must not generate any errors
after beginning stream-oriented output.
after beginning stream-oriented output.
"""
"""
self
.
body
=
self
.
body
+
data
self
.
body
=
self
.
body
+
data
...
@@ -137,7 +137,7 @@ class BaseResponse:
...
@@ -137,7 +137,7 @@ class BaseResponse:
raise
NotFound
(
v
)
raise
NotFound
(
v
)
def
debugError
(
self
,
v
=
''
):
def
debugError
(
self
,
v
=
''
):
"""Raise an error with deb
i
gging info and in debugging mode"""
"""Raise an error with deb
u
gging info and in debugging mode"""
raise
NotFound
(
"Debugging notice: %s"
%
v
)
raise
NotFound
(
"Debugging notice: %s"
%
v
)
def
badRequestError
(
self
,
v
=
''
):
def
badRequestError
(
self
,
v
=
''
):
...
@@ -149,7 +149,7 @@ class BaseResponse:
...
@@ -149,7 +149,7 @@ class BaseResponse:
raise
Forbidden
(
v
)
raise
Forbidden
(
v
)
def
unauthorized
(
self
):
def
unauthorized
(
self
):
"""Raise an er
or indicating that the user was not authizated
"""Raise an er
ror indicating that the user was not authorized.
Make sure to generate an appropriate challenge, as appropriate.
Make sure to generate an appropriate challenge, as appropriate.
"""
"""
...
...
src/ZPublisher/HTTPResponse.py
View file @
d5d72e9a
...
@@ -97,7 +97,7 @@ class HTTPResponse(BaseResponse):
...
@@ -97,7 +97,7 @@ class HTTPResponse(BaseResponse):
The Response type encapsulates all possible responses to HTTP
The Response type encapsulates all possible responses to HTTP
requests. Responses are normally created by the object publisher.
requests. Responses are normally created by the object publisher.
A published object may rec
ie
ve the response abject as an argument
A published object may rec
ei
ve the response abject as an argument
named 'RESPONSE'. A published object may also create it's own
named 'RESPONSE'. A published object may also create it's own
response object. Normally, published objects use response objects
response object. Normally, published objects use response objects
to:
to:
...
...
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