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
f0c25c0b
Commit
f0c25c0b
authored
Mar 04, 2007
by
Martijn Pieters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport fix for 2288, together with part of the 2.10 tests for z3 views
parent
1f7195aa
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
3 deletions
+80
-3
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/ZPublisher/BaseRequest.py
lib/python/ZPublisher/BaseRequest.py
+5
-1
lib/python/ZPublisher/HTTPRequest.py
lib/python/ZPublisher/HTTPRequest.py
+2
-2
lib/python/ZPublisher/tests/testBaseRequest.py
lib/python/ZPublisher/tests/testBaseRequest.py
+70
-0
No files found.
doc/CHANGES.txt
View file @
f0c25c0b
...
...
@@ -8,6 +8,9 @@ Zope Changes
Bugs fixed
- Collector #2288: @ and + should not be quoted when forming
request URLs in BaseRequest and HTTPRequest
- Undeprectated 'zLOG' package, which is going to remain a
backward-compatibility shim for the Python logger.
...
...
lib/python/ZPublisher/BaseRequest.py
View file @
f0c25c0b
...
...
@@ -14,7 +14,7 @@
$Id$
"""
from
urllib
import
quote
from
urllib
import
quote
as
urllib_quote
import
xmlrpc
from
zExceptions
import
Forbidden
...
...
@@ -23,6 +23,10 @@ from zope.app.publication.interfaces import EndRequestEvent
UNSPECIFIED_ROLES
=
''
def
quote
(
text
):
# quote url path segments, but leave + and @ intact
return
urllib_quote
(
text
,
'/+@'
)
try
:
from
ExtensionClass
import
Base
class
RequestContainer
(
Base
):
...
...
lib/python/ZPublisher/HTTPRequest.py
View file @
f0c25c0b
...
...
@@ -15,10 +15,10 @@ __version__='$Revision: 1.96 $'[11:-2]
import
re
,
sys
,
os
,
time
,
random
,
codecs
from
types
import
StringType
,
UnicodeType
from
BaseRequest
import
BaseRequest
from
BaseRequest
import
BaseRequest
,
quote
from
HTTPResponse
import
HTTPResponse
from
cgi
import
FieldStorage
,
escape
from
urllib
import
quote
,
unquote
,
splittype
,
splitport
from
urllib
import
unquote
,
splittype
,
splitport
from
copy
import
deepcopy
from
Converters
import
get_converter
from
TaintedString
import
TaintedString
...
...
lib/python/ZPublisher/tests/testBaseRequest.py
View file @
f0c25c0b
...
...
@@ -248,6 +248,76 @@ class TestBaseRequest(TestCase):
self
.
assertRaises
(
NotFound
,
r
.
traverse
,
'folder/simpleFrozenSet'
)
import
zope.interface
import
zope.component
import
zope.testing.cleanup
import
zope.app.traversing.namespace
from
zope.publisher.browser
import
IBrowserRequest
from
zope.publisher.browser
import
IDefaultBrowserLayer
from
zope.app.traversing.interfaces
import
ITraversable
class
IDummy
(
zope
.
interface
.
Interface
):
"""IDummy"""
class
DummyObjectZ3
(
DummyObjectBasic
):
zope
.
interface
.
implements
(
IDummy
)
def
__init__
(
self
,
name
):
self
.
name
=
name
class
DummyView
(
Implicit
):
def
__init__
(
self
,
content
,
request
):
self
.
content
=
content
self
.
request
=
request
def
__call__
(
self
):
return
'view on %s'
%
(
self
.
content
.
name
)
class
TestBaseRequestZope3Views
(
TestCase
):
def
setUp
(
self
):
zope
.
testing
.
cleanup
.
cleanUp
()
self
.
root
=
DummyObjectBasic
()
folder
=
self
.
root
.
_setObject
(
'folder'
,
DummyObjectZ3
(
'folder'
))
folder
.
_setObject
(
'obj'
,
DummyObjectZ3
(
'obj'
))
gsm
=
zope
.
component
.
getGlobalSiteManager
()
# The request needs to implement the proper interface
zope
.
interface
.
classImplements
(
BaseRequest
,
IDefaultBrowserLayer
)
# Define our 'meth' view
gsm
.
registerAdapter
(
DummyView
,
(
IDummy
,
IDefaultBrowserLayer
),
None
,
'meth'
)
# Bind the 'view' namespace (for @@ traversal)
gsm
.
registerAdapter
(
zope
.
traversing
.
namespace
.
view
,
(
IDummy
,
IDefaultBrowserLayer
),
ITraversable
,
'view'
)
def
tearDown
(
self
):
zope
.
testing
.
cleanup
.
cleanUp
()
def
makeBaseRequest
(
self
):
response
=
HTTPResponse
()
environment
=
{
'URL'
:
''
,
'PARENTS'
:
[
self
.
root
],
'steps'
:
[],
'_hacked_path'
:
0
,
'_test_counter'
:
0
,
'response'
:
response
,
}
return
BaseRequest
(
environment
)
def
test_quoting
(
self
):
"""View markers should not be quoted"""
r
=
self
.
makeBaseRequest
()
r
.
traverse
(
'folder/obj/@@meth'
)
self
.
assertEqual
(
r
[
'URL'
],
'/folder/obj/@@meth'
)
r
=
self
.
makeBaseRequest
()
r
.
traverse
(
'folder/obj/++view++meth'
)
self
.
assertEqual
(
r
[
'URL'
],
'/folder/obj/++view++meth'
)
def
test_suite
():
return
TestSuite
(
(
makeSuite
(
TestBaseRequest
),
)
)
...
...
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