Back to index

plone3  3.1.7
Public Member Functions | Static Private Attributes
kupu.plone.helpers.ButtonFilter Class Reference

List of all members.

Public Member Functions

def __init__

Static Private Attributes

int __allow_access_to_unprotected_subobjects__ = 1

Detailed Description

Helper class to control visibility of buttons.
Works from both a whitelist and a blacklist in the widget.
The configlet also provides a master list of visibilities

Definition at line 58 of file

Constructor & Destructor Documentation

def kupu.plone.helpers.ButtonFilter.__init__ (   self,
  field = None 

Definition at line 65 of file

00066     def __init__(self, tool, context, field=None):
00067         def isButtonAllowed(name):
00068             visible = visible_buttons.get(name, None)
00069             if visible is None:
00070                 visible = FILTERDICT.get(name, True)
00071             if allow_buttons is not None:
00072                 return visible and name in allow_buttons
00073             if filter_buttons is not None:
00074                return visible and name not in filter_buttons
00075             return visible
00077         widget = getattr(field, 'widget', None)
00078         filter_buttons = getattr(widget, 'filter_buttons', None)
00079         allow_buttons = getattr(widget, 'allow_buttons', None)
00080         visible_buttons, gvisible = tool.getToolbarFilters(context, field)
00081         if gvisible is None:
00082             gvisible = FILTERDICT.keys()
00083         else:
00084             for k in FILTERDICT.keys():
00085                 setattr(self, k, False)
00086         for k in gvisible:
00087             setattr(self, k, isButtonAllowed(k))

Member Data Documentation

Definition at line 63 of file

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