[Zope-Checkins]
SVN: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/
removed 'strict' mode (now using unicode as internal
representation) *always*
Andreas Jung
andreas at andreas-jung.com
Sun Dec 17 14:35:18 EST 2006
Log message for revision 71574:
removed 'strict' mode (now using unicode as internal representation) *always*
Changed:
U Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
U Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
-=-
Modified: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py 2006-12-17 19:31:32 UTC (rev 71573)
+++ Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/ZopePageTemplate.py 2006-12-17 19:35:18 UTC (rev 71574)
@@ -90,7 +90,6 @@
func_defaults = None
func_code = FuncCode((), 0)
- strict = True
_default_bindings = {'name_subpath': 'traverse_subpath'}
_default_content_fn = os.path.join(package_home(globals()),
@@ -119,11 +118,9 @@
security.declareProtected(view_management_screens,
'read', 'ZScriptHTML_tryForm')
- def __init__(self, id, text=None, content_type=None, encoding='utf-8',
- strict=True):
+ def __init__(self, id, text=None, content_type=None, encoding='utf-8', strict=True):
self.id = id
self.expand = 0
- self.strict = strict
self.ZBindings_edit(self._default_bindings)
self.output_encoding = encoding
if not text:
@@ -135,7 +132,7 @@
security.declareProtected(change_page_templates, 'pt_edit')
def pt_edit(self, text, content_type, encoding='utf-8'):
text = text.strip()
- if self.strict and not isinstance(text, unicode):
+ if not isinstance(text, unicode):
text = unicode(text, encoding)
self.ZCacheable_invalidate()
@@ -169,7 +166,7 @@
security.declareProtected(change_page_templates, 'pt_setTitle')
def pt_setTitle(self, title, encoding='utf-8'):
- if self.strict and not isinstance(title, unicode):
+ if not isinstance(title, unicode):
title = unicode(title, encoding)
self._setPropValue('title', title)
Modified: Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===================================================================
--- Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2006-12-17 19:31:32 UTC (rev 71573)
+++ Zope/branches/ajung-zpt-encoding-fixes/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2006-12-17 19:35:18 UTC (rev 71574)
@@ -174,14 +174,7 @@
pt = self.app.pt1
self.assertEqual(pt.document_src(), self.text)
- def test_BBB_for_strict_attribute(self):
- # Collector 2213: old templates don't have 'strict' attribute.
- from Products.PageTemplates.ZopePageTemplate import ZopePageTemplate
- zpt = ZopePageTemplate('issue_2213')
- del zpt.strict # simulate old templates
- self.assertEqual(zpt.strict, True)
-
class ZPTMacros(zope.component.testing.PlacelessSetup, unittest.TestCase):
def setUp(self):
More information about the Zope-Checkins
mailing list