Commit 2348d74a authored by Jérome Perrin's avatar Jérome Perrin

wip page template continued"

parent fb3802f7
...@@ -111,16 +111,16 @@ class PageTemplate(XMLObject, ZopePageTemplate, ExpressionMixin('expression')): ...@@ -111,16 +111,16 @@ class PageTemplate(XMLObject, ZopePageTemplate, ExpressionMixin('expression')):
__call__ = ZopePageTemplate.__call__ __call__ = ZopePageTemplate.__call__
# keep `text` stored as unicode for page template engine, but exposed # BBB PY2: keep `text` stored as unicode for page template engine, but
# as an utf-8 encoded string for ERP5 interface. # exposed as an utf-8 encoded str for ERP5 interface
def _setText(self, value): def _setText(self, value):
print ('_setText', repr(value)) #print ('_setText', repr(value))
if six.PY2 and isinstance(value, str): if six.PY2 and isinstance(value, str):
value = value.decode('utf-8') value = value.decode('utf-8')
self.pt_edit(value, self.getContentType()) self.pt_edit(value, self.getContentType())
def getText(self, default=''): def getText(self, default=''):
print('getText') #print('getText')
value = self._text or default value = self._text or default
if six.PY2: if six.PY2:
value = value.encode('utf-8') value = value.encode('utf-8')
......
...@@ -71,7 +71,11 @@ def manage_page_footer(self): ...@@ -71,7 +71,11 @@ def manage_page_footer(self):
elif document.meta_type in ('Z SQL Method', 'ERP5 SQL Method'): elif document.meta_type in ('Z SQL Method', 'ERP5 SQL Method'):
mode = 'sql' mode = 'sql'
textarea_selector = 'textarea[name="template:text"]' textarea_selector = 'textarea[name="template:text"]'
elif document.meta_type in ('Page Template', 'ERP5 OOo Template', ): elif document.meta_type in (
'Page Template',
'ERP5 OOo Template',
'ERP5 Page Template',
):
if 'html' in document.content_type: if 'html' in document.content_type:
if editor == 'codemirror': if editor == 'codemirror':
mode = 'htmlmixed' mode = 'htmlmixed'
......
...@@ -454,7 +454,7 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase): ...@@ -454,7 +454,7 @@ class ERP5TypeFunctionalTestCase(ERP5TypeTestCase):
for page_template_path, page_template in tests_tool.ZopeFind( for page_template_path, page_template in tests_tool.ZopeFind(
tests_tool[self.run_only] if self.run_only else tests_tool, tests_tool[self.run_only] if self.run_only else tests_tool,
obj_metatypes=('Page Template',), search_sub=1): obj_metatypes=('Page Template', 'ERP5 Page Template',), search_sub=1):
try: try:
page_template.pt_render() page_template.pt_render()
except Exception: except Exception:
......
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