Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zope-container
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
Boxiang Sun
zope-container
Commits
c67f4864
Commit
c67f4864
authored
Jun 11, 2008
by
Christophe Combelles
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed #238579 / #163149: error with unicode traversing
parent
a8a5d48d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
1 deletion
+42
-1
CHANGES.txt
CHANGES.txt
+5
-0
src/zope/app/container/browser/tests/test_contents_functional.py
...e/app/container/browser/tests/test_contents_functional.py
+24
-0
src/zope/app/container/tests/test_containertraversable.py
src/zope/app/container/tests/test_containertraversable.py
+5
-0
src/zope/app/container/traversal.py
src/zope/app/container/traversal.py
+8
-1
No files found.
CHANGES.txt
View file @
c67f4864
...
@@ -2,6 +2,11 @@
...
@@ -2,6 +2,11 @@
CHANGES
CHANGES
=======
=======
3.6dev (unreleased)
-------------------
- fixed #238579 / #163149: error with unicode traversing
3.6.0 (2008-05-06)
3.6.0 (2008-05-06)
------------------
------------------
...
...
src/zope/app/container/browser/tests/test_contents_functional.py
View file @
c67f4864
...
@@ -337,6 +337,30 @@ class Test(BrowserTestCase):
...
@@ -337,6 +337,30 @@ class Test(BrowserTestCase):
body
=
response
.
getBody
()
body
=
response
.
getBody
()
self
.
assert_
(
"cannot be moved"
in
body
)
self
.
assert_
(
"cannot be moved"
in
body
)
def
test_copy_then_delete_with_unicode_name
(
self
):
"""Tests unicode on object copied then deleted (#238579)."""
# create a file with an accentuated unicode name
root
=
self
.
getRootFolder
()
root
[
u'voil
\
xe0
'
]
=
File
()
transaction
.
commit
()
# copy the object
response
=
self
.
publish
(
'/@@contents.html'
,
basic
=
'mgr:mgrpw'
,
form
=
{
'ids'
:
(
u'voil
\
xe0
'
,),
'container_copy_button'
:
''
})
self
.
assertEqual
(
response
.
getStatus
(),
302
)
self
.
assertEqual
(
response
.
getHeader
(
'Location'
),
'http://localhost/@@contents.html'
)
response
=
self
.
publish
(
'/@@contents.html'
,
basic
=
'mgr:mgrpw'
)
self
.
assertEqual
(
response
.
getStatus
(),
200
)
# delete the object
del
root
[
u'voil
\
xe0
'
]
transaction
.
commit
()
response
=
self
.
publish
(
'/@@contents.html'
,
basic
=
'mgr:mgrpw'
)
self
.
assertEqual
(
response
.
getStatus
(),
200
)
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
...
...
src/zope/app/container/tests/test_containertraversable.py
View file @
c67f4864
...
@@ -59,6 +59,11 @@ class Test(CleanUp, unittest.TestCase):
...
@@ -59,6 +59,11 @@ class Test(CleanUp, unittest.TestCase):
self
.
failUnless
(
T
.
traverse
(
'bar'
,
[])
is
bar
)
self
.
failUnless
(
T
.
traverse
(
'bar'
,
[])
is
bar
)
self
.
assertRaises
(
TraversalError
,
T
.
traverse
,
'morebar'
,
[])
self
.
assertRaises
(
TraversalError
,
T
.
traverse
,
'morebar'
,
[])
def
test_unicode_attr
(
self
):
# test traversal with unicode
voila
=
Container
()
c
=
Container
({},
{
u'voil
\
xe0
'
:
voila
})
self
.
failUnless
(
ContainerTraversable
(
c
).
traverse
(
u'voil
\
xe0
'
,
[])
is
voila
)
def
test_suite
():
def
test_suite
():
...
...
src/zope/app/container/traversal.py
View file @
c67f4864
...
@@ -95,7 +95,14 @@ class ContainerTraversable(object):
...
@@ -95,7 +95,14 @@ class ContainerTraversable(object):
v
=
container
.
get
(
name
,
_marker
)
v
=
container
.
get
(
name
,
_marker
)
if
v
is
_marker
:
if
v
is
_marker
:
try
:
# Note that if name is a unicode string, getattr will
# implicitly try to encode it using the system
# encoding (usually ascii). Failure to encode means
# invalid attribute name.
v
=
getattr
(
container
,
name
,
_marker
)
v
=
getattr
(
container
,
name
,
_marker
)
except
UnicodeEncodeError
:
raise
TraversalError
(
container
,
name
)
if
v
is
_marker
:
if
v
is
_marker
:
raise
TraversalError
(
container
,
name
)
raise
TraversalError
(
container
,
name
)
...
...
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