Removed preview page as all contents now implement portal context
authorThierry Florac <thierry.florac@onf.fr>
Mon, 11 Jun 2018 15:26:26 +0200
changeset 38 49d7aee43f78
parent 37 b5a695494f88
child 39 b2c3949bb5b8
Removed preview page as all contents now implement portal context
src/pyams_default_theme/page.py
--- a/src/pyams_default_theme/page.py	Mon Jun 11 15:25:36 2018 +0200
+++ b/src/pyams_default_theme/page.py	Mon Jun 11 15:26:26 2018 +0200
@@ -16,44 +16,12 @@
 # import standard library
 
 # import interfaces
-from pyams_content.features.preview.interfaces import IPreviewTarget, IPreviewView
-from pyams_content.features.renderer.interfaces import IContentRenderer
 from pyams_default_theme.layer import IPyAMSDefaultLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
 
 # import packages
-from pyams_pagelet.pagelet import pagelet_config
-from pyams_template.template import layout_config, template_config
-from zope.interface import implementer
-
-
-@pagelet_config(name='', layer=IPyAMSDefaultLayer)
-@layout_config(template='templates/layout.pt', layer=IPyAMSDefaultLayer)
-@template_config(template='templates/index.pt', layer=IPyAMSDefaultLayer)
-class BaseIndexPage(object):
-    """Default base index page"""
+from pyams_template.template import layout_config
 
 
-@pagelet_config(name='preview.html', context=IPreviewTarget, layer=IPyAMSDefaultLayer,
-                permission=VIEW_SYSTEM_PERMISSION)
-@implementer(IPreviewView)
-class PreviewPage(BaseIndexPage):
-    """Preview page"""
-
-    def __init__(self, context, request):
-        super(PreviewPage, self).__init__(context, request)
-        self.language = request.params.get('lang')
-        self.renderers = sorted(request.registry.getAdapters((context, request), IContentRenderer),
-                                key=lambda x: getattr(x[1], 'weight', 0))
-
-    def update(self):
-        super(PreviewPage, self).update()
-        for name, renderer in self.renderers:
-            renderer.language = self.language
-            renderer.update()
-
-    def render(self):
-        result = ''
-        for name, renderer in self.renderers:
-            result += renderer.render()
-        return result
+@layout_config(template='templates/layout.pt', layer=IPyAMSDefaultLayer)
+class BaseIndexPage(object):
+    """Default base index page"""