Back to index

plone3  3.1.7
headerviewlet.py
Go to the documentation of this file.
00001 from zope.interface import implements
00002 from zope.component import getMultiAdapter
00003 from zope.viewlet.interfaces import IViewlet
00004 
00005 from Products.Five.browser import BrowserView
00006 
00007 class KSSBaseUrlViewlet(BrowserView):
00008     """ Renders a link rel tag with the real url of the published object. """
00009     implements(IViewlet)
00010 
00011     def __init__(self, context, request, view, manager):
00012         super(KSSBaseUrlViewlet, self).__init__(context, request)
00013         self.__parent__ = view
00014         self.context = context
00015         self.request = request
00016         self.view = view
00017         self.manager = manager
00018         self.context_state = getMultiAdapter((context, request), name=u'plone_context_state')
00019 
00020     def update(self):
00021         pass
00022 
00023     def render(self):
00024         return u'<link rel="kss-base-url" href="%s" />' % self.context_state.object_url()