[prev in list] [next in list] [prev in thread] [next in thread]
List: zope-cvs
Subject: [Zope-Checkins]
From: Andreas Jung <andreas () andreas-jung ! com>
Date: 2006-12-29 12:07:11
Message-ID: 20061229120711.93F7F20334A () mail ! zope ! org
[Download RAW message or body]
Log message for revision 71672:
write() auto-converts to unicode instead of throwing an exception
Changed:
U Zope/branches/2.10/lib/python/Products/PageTemplates/ZopePageTemplate.py
U Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
-=-
Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PageTemplates/ZopePageTemplate.py 2006-12-29 \
11:55:56 UTC (rev 71671)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/ZopePageTemplate.py 2006-12-29 \
12:07:11 UTC (rev 71672) @@ -285,8 +285,11 @@
return c
def write(self, text):
+
if not isinstance(text, unicode):
- raise TypeError("'text' parameter must be unicode")
+ text, encoding = convertToUnicode(text, self.content_type, \
preferred_encodings) + self.output_encoding = encoding
+
self.ZCacheable_invalidate()
ZopePageTemplate.inheritedAttribute('write')(self, text)
Modified: Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py
===================================================================
--- Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2006-12-29 \
11:55:56 UTC (rev 71671)
+++ Zope/branches/2.10/lib/python/Products/PageTemplates/tests/testZopePageTemplate.py 2006-12-29 \
12:07:11 UTC (rev 71672) @@ -112,12 +112,6 @@
self.assertEqual(zpt.read(), s)
self.assertEqual(isinstance(zpt.read(), unicode), True)
- def testWriteWontAcceptsNonUnicode(self):
- manage_addPageTemplate(self.app, 'test', '', encoding='utf-8')
- zpt = self.app['test']
- self.assertRaises(TypeError, zpt.write, 'this is not unicode')
-
-
def _createZPT(self):
manage_addPageTemplate(self.app, 'test', text=utf8_str, encoding='utf-8')
zpt = self.app['test']
_______________________________________________
Zope-Checkins maillist - Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic