Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
Archetypes.generator.widget.macrowidget Class Reference
Inheritance diagram for Archetypes.generator.widget.macrowidget:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.generator.widget.macrowidget:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def bootstrap
def __call__
def getContext
def Label
def Description

Static Public Attributes

tuple security = ClassSecurityInfo()

Static Private Attributes

tuple _properties = widget._properties.copy()

Detailed Description

Macro is the file containing the macros, the mode/view is the
name of the macro in that file.

Definition at line 113 of file widget.py.


Member Function Documentation

def Archetypes.generator.widget.macrowidget.__call__ (   self,
  mode,
  instance,
  context = None 
)
Not implemented.

Reimplemented from Archetypes.generator.widget.widget.

Definition at line 127 of file widget.py.

00127 
00128     def __call__(self, mode, instance, context=None):
00129         self.bootstrap(instance)
00130         # If an attribute called macro_<mode> exists resolve that
00131         # before the generic macro, this lets other projects
00132         # create more partial widgets
00133         macro = getattr(self, 'macro_%s' % mode, self.macro)
00134         # Now split the macro into optional parts using '|'
00135         # if the first part doesn't exist, the search continues
00136         paths = macro.split('|')
00137         if len(paths) == 1 and macro == self.macro:
00138             # Prepend the default (optional) customization element
00139             paths.insert(0, 'at_widget_%s' % self.macro.split('/')[-1])
00140         for path in paths:
00141             try:
00142                 template = instance.restrictedTraverse(path = path)
00143                 if template:
00144                     return template.macros[mode]
00145             except (Unauthorized, AttributeError, KeyError):
00146                 # This means we didn't have access or it doesn't exist
00147                 pass
00148         raise AttributeError("Macro %s does not exist for %s" %(macro,
00149                                                                 instance))
00150 
00151 InitializeClass(widget)

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.generator.widget.macrowidget.bootstrap (   self,
  instance 
)

Definition at line 123 of file widget.py.

00123 
00124     def bootstrap(self, instance):
00125         # Do initialization-like thingies that need the instance
00126         pass

Here is the caller graph for this function:

def Archetypes.generator.widget.widget.Description (   self,
  instance,
  kwargs 
) [inherited]
Returns the description, possibly translated.

Definition at line 100 of file widget.py.

00100 
00101     def Description(self, instance, **kwargs):
00102         """Returns the description, possibly translated."""
00103         value = self.description
00104         method = value and getattr(aq_inner(instance), value, None)
00105         if method and callable(method):
00106             # Description methods can be called with kwargs and should
00107             # return the i18n version of the description
00108             value = method(**kwargs)
00109             return value
00110         target_language = kwargs.get('target_language', None)
00111         return self._translate_attribute(instance, 'description')
00112 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.generator.widget.widget.getContext (   self,
  instance 
) [inherited]
Returns a prepared context or an empty {}.

Definition at line 66 of file widget.py.

00066 
00067     def getContext(self, instance):
00068         """Returns a prepared context or an empty {}."""
00069         return {}

Here is the caller graph for this function:

def Archetypes.generator.widget.widget.Label (   self,
  instance,
  kwargs 
) [inherited]
Returns the label, possibly translated.

Definition at line 89 of file widget.py.

00089 
00090     def Label(self, instance, **kwargs):
00091         """Returns the label, possibly translated."""
00092         value = getattr(self, 'label_method', None)
00093         method = value and getattr(aq_inner(instance), value, None)
00094         if method and callable(method):
00095             # Label methods can be called with kwargs and should
00096             # return the i18n version of the description
00097             value = method(**kwargs)
00098             return value
00099         return self._translate_attribute(instance, 'label')

Here is the call graph for this function:


Member Data Documentation

tuple Archetypes.generator.widget.macrowidget._properties = widget._properties.copy() [static, private]

Reimplemented from Archetypes.generator.widget.widget.

Definition at line 118 of file widget.py.

tuple Archetypes.generator.widget.widget.security = ClassSecurityInfo() [static, inherited]

Definition at line 44 of file widget.py.


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