Back to index

plone3  3.1.7
info.py
Go to the documentation of this file.
00001 from zope.interface import implements
00002 from zope.component import getMultiAdapter
00003 
00004 from zope.viewlet.interfaces import IViewlet
00005 
00006 from Products.Five.browser import BrowserView
00007 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
00008 
00009 from plone.locking.interfaces import ILockable
00010 
00011 class LockInfoViewlet(BrowserView):
00012     """This is a viewlet which is not hooked up anywhere. It is referenced 
00013     from plone.app.layout. We do it this way to avoid having the  lower-level 
00014     plone.locking depend on these packages, whilst still providing
00015     an implementation of the info box in a single place.
00016     """
00017     implements(IViewlet)
00018     
00019     template = ViewPageTemplateFile('info.pt')
00020 
00021     def __init__(self, context, request, view, manager):
00022         super(LockInfoViewlet, self).__init__(context, request)
00023         self.__parent__ = view
00024         self.context = context
00025         self.request = request
00026         self.view = view
00027         self.manager = manager
00028         self.info = getMultiAdapter((context, request), name="plone_lock_info")
00029 
00030     def update(self):
00031         pass
00032 
00033     def render(self):
00034         return self.template()
00035     
00036     def lock_is_stealable(self):
00037         return self.info.lock_is_stealable()
00038         
00039     def lock_info(self):
00040         return self.info.lock_info()