Back to index

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

List of all members.

Public Member Functions

def __init__
def update
def render
def __of__

Public Attributes

 context
 request
 template
 view
 viewlet
 manager
 ttwviewlet
 permission

Private Member Functions

def _getViewlet

Static Private Attributes

 __allow_access_to_unprotected_subobjects__ = True

Detailed Description

analogon to TTWViewTemplateRenderer for viewlets 

Definition at line 107 of file zpt.py.


Constructor & Destructor Documentation

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

Definition at line 113 of file zpt.py.

00113 
00114     def __init__(self, context, request, template, view, viewlet=None, manager=None, permission=None):
00115         self.context = context
00116         self.request = request
00117         self.template = template
00118         self.view = view
00119         self.viewlet = viewlet
00120         self.manager = manager
00121         self.ttwviewlet = None
00122         self.permission = permission

Here is the caller graph for this function:


Member Function Documentation

Definition at line 161 of file zpt.py.

00161 
00162     def __of__(self, obj):
00163         return self
00164 

Definition at line 140 of file zpt.py.

00140 
00141     def _getViewlet(self):
00142         checkPermission(self.permission, self.context)
00143         if self.ttwviewlet is not None:
00144             return self.ttwviewlet
00145         view = self.view
00146         if view is not None:
00147             # Filesystem-based view templates are trusted code and
00148             # have unrestricted access to the view class.  We simulate
00149             # that for TTW templates (which are trusted code) by
00150             # creating a subclass with unrestricted access to all
00151             # subobjects.
00152             class TTWViewlet(view, ViewletBase):
00153                 __allow_access_to_unprotected_subobjects__ = 1
00154             view = TTWViewlet(self.context, self.request, self.viewlet, self.manager)
00155         self.ttwviewlet = view
00156         return view

Here is the caller graph for this function:

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

Definition at line 127 of file zpt.py.

00127 
00128     def render(self, *args, **kwargs):
00129         """ render the viewlet using the customized template """
00130         view = self._getViewlet()
00131         # we need to override the template's context and request as
00132         # they generally point to the wrong objects (a template's
00133         # context usually is what it was acquired from, which isn't
00134         # what the context is for a view template).
00135         bound_names = {'context': self.context,
00136                        'request': self.request,
00137                        'view': view}
00138         template = self.template.__of__(self.context)
00139         return template._exec(bound_names, args, kwargs)

Here is the call graph for this function:

update the viewlet before `render` is called 

Definition at line 123 of file zpt.py.

00123 
00124     def update(self):
00125         """ update the viewlet before `render` is called """
00126         view = self._getViewlet().update()

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 111 of file zpt.py.

Definition at line 114 of file zpt.py.

Definition at line 119 of file zpt.py.

Definition at line 121 of file zpt.py.

Definition at line 115 of file zpt.py.

Definition at line 116 of file zpt.py.

Definition at line 120 of file zpt.py.

Definition at line 117 of file zpt.py.

Definition at line 118 of file zpt.py.


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