Commit ec56ce7e authored by Andreas Jung's avatar Andreas Jung

removed pt_encoding() since we use utf-8 in the ZMI only

parent 8ee69e8f
......@@ -127,14 +127,6 @@ class ZopePageTemplate(Script, PageTemplate, Historical, Cacheable,
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 @@ def manage_addPageTemplate(self, id, title='', text=None, encoding='utf-8', subm
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 @@ def manage_addPageTemplate(self, id, title='', text=None, encoding='utf-8', subm
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()
......
<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">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment