[Zope-Checkins] SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ removed pt_encoding() since we use utf-8 in the ZMI only

Andreas Jung andreas at andreas-jung.com
Sat Dec 17 05:17:24 EST 2005


Log message for revision 40840:
  removed pt_encoding() since we use utf-8 in the ZMI only
  

Changed:
  U   Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py
  U   Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/pt/ptEdit.pt

-=-
Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py
===================================================================
--- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py	2005-12-16 23:01:06 UTC (rev 40839)
+++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/ZopePageTemplate.py	2005-12-17 10:17:23 UTC (rev 40840)
@@ -127,14 +127,6 @@
         self.ZBindings_edit(self._default_bindings)
         self.pt_edit(text, content_type, encoding)
 
-    security.declareProtected(change_page_templates, 'pt_encoding')
-    def pt_encoding(self):
-        encoding = sniffEncoding(self.read())
-        return encoding                
-
-    from ComputedAttribute import ComputedAttribute
-    management_page_charset = ComputedAttribute(pt_encoding, 1)
-
     security.declareProtected(change_page_templates, 'pt_edit')
     def pt_edit(self, text, content_type, encoding='utf-8'):
 
@@ -423,7 +415,7 @@
             content_type = headers['content_type']
         else:
             content_type = guess_type(filename, text) 
-        encoding = sniffEncoding(text)
+        encoding = sniffEncoding(text, encoding)
 
     else:
         if hasattr(text, 'read'):
@@ -434,6 +426,7 @@
                 content_type = headers['content_type']
             else:
                 content_type = guess_type(filename, text) 
+        encoding = sniffEncoding(text, encoding)
 
     if not text:
         text = open(_default_content_fn).read()

Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/pt/ptEdit.pt
===================================================================
--- Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/pt/ptEdit.pt	2005-12-16 23:01:06 UTC (rev 40839)
+++ Zope/branches/ajung-zpt-integration/lib/python/Products/PageTemplates/pt/ptEdit.pt	2005-12-17 10:17:23 UTC (rev 40840)
@@ -1,5 +1,5 @@
 
-<h1 tal:replace="structure python: context.manage_page_header(management_page_charset=context.pt_encoding())">Header</h1>
+<h1 tal:replace="structure python: context.manage_page_header(management_page_charset='utf-8')">Header</h1>
 <h2 tal:define="manage_tabs_message options/manage_tabs_message | nothing"
     tal:replace="structure context/manage_tabs">Tabs</h2>
 
@@ -7,7 +7,7 @@
 | context/read" /> 
 <form action="" method="post" tal:attributes="action request/URL1">
 <input type="hidden" name=":default_method" value="pt_changePrefs">
-<input type="hidden" name="encoding" tal:attributes="value context/pt_encoding" />
+<input type="hidden" name="encoding" value="utf-8"/>
 <table width="100%" cellspacing="0" cellpadding="2" border="0">
   <tr>
     <td align="left" valign="middle">



More information about the Zope-Checkins mailing list