Exemplo n.º 1
0
 def render(self):
     view = queryMultiAdapter((self.context, self.request), name="content.html")
     if view is None:
         raise NotFound("content.html")
     if IView.providedBy(view) and view.content is None:
         msg = _("Sorry, this ${meta_type} is not viewable.", mapping={"meta_type": self.context.meta_type})
         return "<p>%s</p>" % translate(msg, context=self.request)
     return view()
 def update(self):
     applySkin(self.request, IPrintSkin)
     self.html = None
     view = queryMultiAdapter(
         (self.context, self.request), name='content.html')
     if view is None:
         raise NotFound('content.html')
     if IView.providedBy(view) and view.content is not None:
         self.html = view()
Exemplo n.º 3
0
 def render(self):
     default = self.context.get_default()
     if default is None:
         return self.unavailable_message
     view = queryMultiAdapter((default, self.request), name="content.html")
     if view is None:
         return self.unavailable_message
     if IView.providedBy(view) and view.content is None:
         return self.unavailable_message
     return view()
Exemplo n.º 4
0
 def render(self):
     haunted = self.content.get_haunted()
     if haunted is None:
         return self.broken_message
     permission = self.is_preview and 'Read Silva content' or 'View'
     if not getSecurityManager().checkPermission(permission, haunted):
         raise Unauthorized(u"You do not have permission to "
                            u"see the target of this ghost")
     view = queryMultiAdapter((haunted, self.request), name="content.html")
     if view is None:
         return self.broken_message
     if IView.providedBy(view) and view.content is None:
         return self.broken_message
     return view()
Exemplo n.º 5
0
 def render(self):
     haunted = self.content.get_haunted()
     if haunted is None:
         return self.broken_message
     permission = self.is_preview and 'Read Silva content' or 'View'
     if not getSecurityManager().checkPermission(permission, haunted):
         raise Unauthorized(
             u"You do not have permission to "
             u"see the target of this ghost")
     view = queryMultiAdapter((haunted, self.request), name="content.html")
     if view is None:
         return self.broken_message
     if IView.providedBy(view) and view.content is None:
         return self.broken_message
     return view()