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
5812fee7
Commit
5812fee7
authored
Mar 04, 2008
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Launchpad #198274: "empty" ZopePageTemplates could not be unpickled.
parent
7c50e72f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
1 deletion
+16
-1
doc/CHANGES.txt
doc/CHANGES.txt
+3
-0
lib/python/Products/PageTemplates/ZopePageTemplate.py
lib/python/Products/PageTemplates/ZopePageTemplate.py
+2
-1
lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
...thon/Products/PageTemplates/tests/testZopePageTemplate.py
+11
-0
No files found.
doc/CHANGES.txt
View file @
5812fee7
...
@@ -8,6 +8,9 @@ Zope Changes
...
@@ -8,6 +8,9 @@ Zope Changes
Bugs Fixed
Bugs Fixed
- Launchpad #198274: "empty" ZopePageTemplates could not be
unpickled.
Zope 2.11 beta 1 (2007/12/29)
Zope 2.11 beta 1 (2007/12/29)
Restructuring
Restructuring
...
...
lib/python/Products/PageTemplates/ZopePageTemplate.py
View file @
5812fee7
...
@@ -413,7 +413,8 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
...
@@ -413,7 +413,8 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
# Perform on-the-fly migration to unicode.
# Perform on-the-fly migration to unicode.
# Perhaps it might be better to work with the 'generation' module
# Perhaps it might be better to work with the 'generation' module
# here?
# here?
if
not
isinstance
(
state
[
'_text'
],
unicode
):
_text
=
state
.
get
(
'_text'
)
if
_text
is
not
None
and
not
isinstance
(
state
[
'_text'
],
unicode
):
text
,
encoding
=
convertToUnicode
(
state
[
'_text'
],
text
,
encoding
=
convertToUnicode
(
state
[
'_text'
],
state
.
get
(
'content_type'
,
'text/html'
),
state
.
get
(
'content_type'
,
'text/html'
),
preferred_encodings
)
preferred_encodings
)
...
...
lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
View file @
5812fee7
...
@@ -141,6 +141,17 @@ class ZPTUnicodeEncodingConflictResolution(ZopeTestCase):
...
@@ -141,6 +141,17 @@ class ZPTUnicodeEncodingConflictResolution(ZopeTestCase):
result
=
zpt
.
pt_render
()
result
=
zpt
.
pt_render
()
self
.
assertEqual
(
result
.
startswith
(
unicode
(
'<div></div>'
,
'iso-8859-15'
)),
True
)
self
.
assertEqual
(
result
.
startswith
(
unicode
(
'<div></div>'
,
'iso-8859-15'
)),
True
)
def
test_bug_198274
(
self
):
# See https://bugs.launchpad.net/bugs/198274
# ZPT w/ '_text' not assigned can't be unpickled.
import
cPickle
empty
=
ZopePageTemplate
(
id
=
'empty'
,
text
=
' '
,
content_type
=
'text/html'
,
output_encoding
=
'ascii'
,
)
state
=
cPickle
.
dumps
(
empty
,
protocol
=
1
)
clone
=
cPickle
.
loads
(
state
)
class
ZopePageTemplateFileTests
(
ZopeTestCase
):
class
ZopePageTemplateFileTests
(
ZopeTestCase
):
def
testPT_RenderWithAscii
(
self
):
def
testPT_RenderWithAscii
(
self
):
...
...
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