Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
plone.portlets.manager.PortletManagerRenderer Class Reference

List of all members.

Public Member Functions

def __init__
def visible
def filter
def portletsToShow
def update
def render
def safe_render

Public Attributes

 manager
 context
 request

Static Public Attributes

 template = None
 error_message = None

Private Member Functions

def _lazyLoadPortlets
def _dataToPortlet

Private Attributes

 __parent__
 __updated

Detailed Description

Default renderer for portlet managers.

When the zope.contentprovider handler for the provider: expression looks up
a name, context, it will find an adapter factory that in turn finds an 
instance of this class, by doing an adapter lookup for (context, request,
view, manager).

Definition at line 26 of file manager.py.


Constructor & Destructor Documentation

def plone.portlets.manager.PortletManagerRenderer.__init__ (   self,
  context,
  request,
  view,
  manager 
)

Definition at line 40 of file manager.py.

00040 
00041     def __init__(self, context, request, view, manager):
00042         self.__parent__ = view
00043         self.manager = manager # part of interface
00044         self.context = context
00045         self.request = request
00046         self.__updated = False
        

Here is the caller graph for this function:


Member Function Documentation

Helper method to get the correct IPortletRenderer for the given
data object.

Definition at line 119 of file manager.py.

00119 
00120     def _dataToPortlet(self, data):
00121         """Helper method to get the correct IPortletRenderer for the given
00122         data object.
00123         """
00124         return getMultiAdapter((self.context, self.request, self.__parent__,
00125                                     self.manager, data,), IPortletRenderer)

Here is the caller graph for this function:

def plone.portlets.manager.PortletManagerRenderer._lazyLoadPortlets (   self,
  manager 
) [private]

Definition at line 99 of file manager.py.

00099 
00100     def _lazyLoadPortlets(self, manager):
00101         retriever = getMultiAdapter((self.context, manager), IPortletRetriever)
00102         items = []
00103         for p in self.filter(retriever.getPortlets()):
00104             renderer = self._dataToPortlet(p['assignment'].data)
00105             try:
00106                 isAvailable = renderer.available
00107             except ConflictError:
00108                 raise
00109             except Exception, e:
00110                 isAvailable = False
00111                 logger.exception('Error while determining renderer availability of portlet %r: %s' % (p, str(e)))
00112             if isAvailable:
00113                 info = p.copy()
00114                 info['manager'] = self.manager.__name__
00115                 info['renderer'] = renderer
00116                 hashPortletInfo(info)
00117                 items.append(info)
00118         return items
    

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 52 of file manager.py.

00052 
00053     def filter(self, portlets):
00054         filtered = []
00055         for p in portlets:
00056             try:
00057                 if p['assignment'].available:
00058                     filtered.append(p)
00059             except ConflictError:
00060                 raise
00061             except Exception, e:
00062                 logger.exception('Error while determining assignment availability of portlet %r: %s' % (p, str(e)))
00063         return filtered 
        

Here is the caller graph for this function:

Definition at line 64 of file manager.py.

00064 
00065     def portletsToShow(self):
00066         return self._lazyLoadPortlets(self.manager)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 72 of file manager.py.

00072 
00073     def render(self):
00074         if not self.__updated:
00075             raise UpdateNotCalled
00076             
00077         portlets = self.portletsToShow()
00078         if self.template:
00079             return self.template(portlets=portlets)
00080         else:
00081             return u'\n'.join([p['renderer'].render() for p in portlets])

Here is the call graph for this function:

def plone.portlets.manager.PortletManagerRenderer.safe_render (   self,
  portlet_renderer 
)

Definition at line 82 of file manager.py.

00082 
00083     def safe_render(self, portlet_renderer):
00084         try:
00085             return portlet_renderer.render()
00086         except ConflictError:
00087             raise
00088         except Exception:
00089             logger.exception('Error while rendering %r' % (self,))
00090             return self.error_message()

Definition at line 67 of file manager.py.

00067 
00068     def update(self):
00069         self.__updated = True
00070         for p in self.portletsToShow():
00071             p['renderer'].update()

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 48 of file manager.py.

00048 
00049     def visible(self):
00050         portlets = self.portletsToShow()
00051         return len(portlets) > 0

Here is the call graph for this function:


Member Data Documentation

Definition at line 41 of file manager.py.

Definition at line 45 of file manager.py.

Definition at line 43 of file manager.py.

Definition at line 38 of file manager.py.

Definition at line 42 of file manager.py.

Definition at line 44 of file manager.py.

Definition at line 37 of file manager.py.


The documentation for this class was generated from the following file: