[Checkins] SVN: five.pt/trunk/src/five/pt/ Adding utf-8 default encoding for PageTemplates

Patrick Gerken do3ccqrv at gmail.com
Fri May 28 08:12:20 EDT 2010


Log message for revision 112796:
  Adding utf-8 default encoding for PageTemplates
  
  Too many things in Zope like to return utf-8 encoded strings.

Changed:
  U   five.pt/trunk/src/five/pt/pagetemplate.py
  U   five.pt/trunk/src/five/pt/zcml.txt

-=-
Modified: five.pt/trunk/src/five/pt/pagetemplate.py
===================================================================
--- five.pt/trunk/src/five/pt/pagetemplate.py	2010-05-28 11:56:29 UTC (rev 112795)
+++ five.pt/trunk/src/five/pt/pagetemplate.py	2010-05-28 12:12:20 UTC (rev 112796)
@@ -67,6 +67,8 @@
 
 class ViewPageTemplate(pagetemplate.ViewPageTemplate):
 
+    encoding = 'UTF-8'
+
     def _pt_get_context(self, view, request, kwargs):
         if view is None:
             namespace = {}

Modified: five.pt/trunk/src/five/pt/zcml.txt
===================================================================
--- five.pt/trunk/src/five/pt/zcml.txt	2010-05-28 11:56:29 UTC (rev 112795)
+++ five.pt/trunk/src/five/pt/zcml.txt	2010-05-28 12:12:20 UTC (rev 112796)
@@ -48,6 +48,13 @@
   >>> issubclass(factory, View)
   True
 
+Our views will often get utf-8 encoded strings from Zope. They must be
+able to handle that. The PageTemplate class has an attribute encoding, that
+is being used for decoding strings.
+
+  >>> factory.index.encoding
+  'UTF-8'
+
 If the ``__call__`` attribute is set to a template, calling the view will
 render the template.
 



More information about the checkins mailing list