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
508354e6
Commit
508354e6
authored
Aug 02, 2008
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tests for edgecase where the resolver has no REQUEST object
parent
a717c7be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
...thon/Products/PageTemplates/tests/testZopePageTemplate.py
+18
-0
lib/python/Products/PageTemplates/unicodeconflictresolver.py
lib/python/Products/PageTemplates/unicodeconflictresolver.py
+1
-0
No files found.
lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
View file @
508354e6
...
...
@@ -339,6 +339,23 @@ class ZopePageTemplateFileTests(ZopeTestCase):
result
=
zpt
.
pt_render
()
self
.
assertEqual
(
'ATTR'
in
result
,
False
)
class
PreferredEncodingUnicodeResolverTests
(
unittest
.
TestCase
):
def
testPreferredCharsetResolverWithoutRequestAndWithoutEncoding
(
self
):
# This test checks the edgecase where the unicode conflict resolver
# is called with a context object having no REQUEST
context
=
object
()
result
=
PreferredCharsetResolver
.
resolve
(
context
,
''
,
None
)
self
.
assertEqual
(
result
,
''
)
def
testPreferredCharsetResolverWithoutRequestAndWithEncoding
(
self
):
# This test checks the edgecase where the unicode conflict resolver
# is called with a context object having no REQUEST
class
ContextMock
:
management_page_charset
=
'iso-8859-15'
result
=
PreferredCharsetResolver
.
resolve
(
ContextMock
(),
''
,
None
)
self
.
assertEqual
(
result
,
u''
)
class
ZPTRegressions
(
unittest
.
TestCase
):
...
...
@@ -463,6 +480,7 @@ def test_suite():
suite
.
addTests
(
unittest
.
makeSuite
(
ZPTMacros
))
suite
.
addTests
(
unittest
.
makeSuite
(
ZopePageTemplateFileTests
))
suite
.
addTests
(
unittest
.
makeSuite
(
ZPTUnicodeEncodingConflictResolution
))
suite
.
addTests
(
unittest
.
makeSuite
(
PreferredEncodingUnicodeResolverTests
))
return
suite
if
__name__
==
'__main__'
:
...
...
lib/python/Products/PageTemplates/unicodeconflictresolver.py
View file @
508354e6
...
...
@@ -67,6 +67,7 @@ class PreferredCharsetResolver:
# Deal with the fact that a REQUEST is not always available.
# In this case fall back to the encoding of the ZMI and the
# Python default encoding.
if
request
is
None
:
charsets
=
[
default_encoding
]
management_charset
=
getattr
(
context
,
'management_page_charset'
,
None
)
...
...
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