Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
Archetypes.Renderer.ArchetypesRenderer Class Reference

List of all members.

Public Member Functions

def render
def setupContext

Static Public Attributes

tuple security = ClassSecurityInfo()

Detailed Description

Definition at line 8 of file Renderer.py.


Member Function Documentation

def Archetypes.Renderer.ArchetypesRenderer.render (   self,
  field_name,
  mode,
  widget,
  instance = None,
  field = None,
  accessor = None,
  kwargs 
)

Definition at line 14 of file Renderer.py.

00014 
00015                field=None, accessor=None, **kwargs):
00016         if field is None:
00017             field = instance.Schema()[field_name]
00018 
00019         if accessor is None:
00020             accessor = field.getAccessor(instance)
00021 
00022         context = self.setupContext(field_name, mode, widget,
00023                                     instance, field, accessor, **kwargs)
00024 
00025         result = widget(mode, instance, context)
00026 
00027         del context
00028         return result    
    

Here is the call graph for this function:

def Archetypes.Renderer.ArchetypesRenderer.setupContext (   self,
  field_name,
  mode,
  widget,
  instance,
  field,
  accessor,
  kwargs 
)

Definition at line 30 of file Renderer.py.

00030 
00031                      accessor, **kwargs):
00032 
00033         # look for the context in the stack
00034         frame = sys._getframe()
00035         context = _marker
00036         while context is _marker and frame is not None:
00037             context = frame.f_locals.get('econtext', _marker)
00038             frame = frame.f_back
00039         if context is _marker:
00040             raise RuntimeError, 'Context not found'
00041         
00042         # for editing of multiple AT-based content at once we might want to 
00043         # prefix the field-name.
00044         if 'fieldprefix' in kwargs:
00045             field_name = '%s%s' % (kwargs['fieldprefix'], field_name)
00046 
00047         widget = ImplicitAcquisitionWrapper(widget, instance)
00048         field = ImplicitAcquisitionWrapper(field, instance)
00049         context.setLocal('here', instance)
00050         context.setLocal('fieldName', field_name)
00051         context.setLocal('accessor', accessor)
00052         context.setLocal('widget', widget)
00053         context.setLocal('field', field)
00054         context.setLocal('mode', mode)
00055 
00056         if kwargs:
00057             for k,v in kwargs.items():
00058                 context.setLocal(k, v)
00059 
00060         del frame
00061         return context
00062 
00063 InitializeClass(ArchetypesRenderer)

Here is the caller graph for this function:


Member Data Documentation

tuple Archetypes.Renderer.ArchetypesRenderer.security = ClassSecurityInfo() [static]

Definition at line 10 of file Renderer.py.


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