Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Private Member Functions | Static Private Attributes
five.customerize.zpt.TTWPortletRenderer Class Reference

List of all members.

Public Member Functions

def __init__
def update
def render
def available
def __of__

Public Attributes

 context
 request
 template
 view
 manager
 data
 renderer
 permission

Private Member Functions

def _getRenderer

Static Private Attributes

 __allow_access_to_unprotected_subobjects__ = True

Detailed Description

analogon to TTWViewletRenderer for portlets 

Definition at line 165 of file zpt.py.


Constructor & Destructor Documentation

def five.customerize.zpt.TTWPortletRenderer.__init__ (   self,
  context,
  request,
  template,
  view,
  manager = None,
  data = None,
  permission = None 
)

Definition at line 171 of file zpt.py.

00171 
00172     def __init__(self, context, request, template, view, manager=None, data=None, permission=None):
00173         self.context = context
00174         self.request = request
00175         self.template = template
00176         self.view = view
00177         self.manager = manager
00178         self.data = data
00179         self.renderer = None
00180         self.permission = permission

Here is the caller graph for this function:


Member Function Documentation

Definition at line 223 of file zpt.py.

00223 
00224     def __of__(self, obj):
00225         return self
00226 
00227 
@adapter(TTWViewTemplate, IObjectRemovedEvent)

Definition at line 198 of file zpt.py.

00198 
00199     def _getRenderer(self):
00200         checkPermission(self.permission, self.context)
00201         if self.renderer is not None:
00202             return self.renderer
00203         view = self.view
00204         if view is not None:
00205             # Filesystem-based view templates are trusted code and
00206             # have unrestricted access to the view class.  We simulate
00207             # that for TTW templates (which are trusted code) by
00208             # creating a subclass with unrestricted access to all
00209             # subobjects.
00210             class TTWPortlet(view):
00211                 __allow_access_to_unprotected_subobjects__ = 1
00212             view = TTWPortlet(self.context, self.request, self.view, self.manager, self.data)
00213         self.renderer = view
00214         return view

Here is the caller graph for this function:

Definition at line 216 of file zpt.py.

00216 
00217     def available(self):
00218         return self._getRenderer().available

Here is the call graph for this function:

Here is the caller graph for this function:

def five.customerize.zpt.TTWPortletRenderer.render (   self,
  args,
  kwargs 
)
render the portlet using the customized template 

Definition at line 185 of file zpt.py.

00185 
00186     def render(self, *args, **kwargs):
00187         """ render the portlet using the customized template """
00188         view = self._getRenderer()
00189         # we need to override the template's context and request as
00190         # they generally point to the wrong objects (a template's
00191         # context usually is what it was acquired from, which isn't
00192         # what the context is for a view template).
00193         bound_names = {'context': self.context,
00194                        'request': self.request,
00195                        'view': view}
00196         template = self.template.__of__(self.context)
00197         return template._exec(bound_names, args, kwargs)

Here is the call graph for this function:

update the portlet before `render` is called 

Definition at line 181 of file zpt.py.

00181 
00182     def update(self):
00183         """ update the portlet before `render` is called """
00184         view = self._getRenderer().update()

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 169 of file zpt.py.

Definition at line 172 of file zpt.py.

Definition at line 177 of file zpt.py.

Definition at line 176 of file zpt.py.

Definition at line 179 of file zpt.py.

Definition at line 178 of file zpt.py.

Definition at line 173 of file zpt.py.

Definition at line 174 of file zpt.py.

Definition at line 175 of file zpt.py.


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