Back to index

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

List of all members.

Public Member Functions

def process_form
def getName
def getType
def bootstrap
def populateProps
def isVisible
def setCondition
def getCondition
def testCondition
def copy

Public Attributes

 label
 condition

Static Public Attributes

tuple security = ClassSecurityInfo()

Static Private Attributes

tuple _properties = TextAreaWidget._properties.copy()

Detailed Description

Definition at line 749 of file Widget.py.


Member Function Documentation

def Archetypes.Widget.TypesWidget.bootstrap (   self,
  instance 
) [inherited]
Override if your widget needs data from the instance.

Definition at line 49 of file Widget.py.

00049 
00050     def bootstrap(self, instance):
00051         """Override if your widget needs data from the instance."""
00052         return

def Archetypes.Widget.TypesWidget.copy (   self) [inherited]
Return a copy of widget instance, consisting of field name and
properties dictionary.

Definition at line 130 of file Widget.py.

00130 
00131     def copy(self):
00132         """
00133         Return a copy of widget instance, consisting of field name and
00134         properties dictionary.
00135         """
00136         cdict = dict(vars(self))
00137         properties = deepcopy(cdict)
00138         return self.__class__(**properties)
00139 
00140 InitializeClass(TypesWidget)

Here is the call graph for this function:

def Archetypes.Widget.TypesWidget.getCondition (   self) [inherited]
Return the widget text condition.

Definition at line 101 of file Widget.py.

00101 
00102     def getCondition(self):
00103         """Return the widget text condition."""
00104         return self.condition

def Archetypes.Widget.TypesWidget.getName (   self) [inherited]

Definition at line 40 of file Widget.py.

00040 
00041     def getName(self):
00042         return self.__class__.__name__

Here is the caller graph for this function:

def Archetypes.Widget.TypesWidget.getType (   self) [inherited]
Return the type of this field as a string

Definition at line 44 of file Widget.py.

00044 
00045     def getType(self):
00046         """Return the type of this field as a string"""
00047         return className(self)

Here is the call graph for this function:

def Archetypes.Widget.TypesWidget.isVisible (   self,
  instance,
  mode = 'view' 
) [inherited]
decide if a field is visible in a given mode -> 'state'

Return values are visible, hidden, invisible

The value for the attribute on the field may either be a dict with a
mapping for edit and view::

    visible = { 'edit' :'hidden', 'view' : 'invisible' }

Or a single value for all modes::

    True/1:  'visible'
    False/0: 'invisible'
    -1:      'hidden'
    
visible: The field is shown in the view/edit screen
invisible: The field is skipped when rendering the view/edit screen
hidden: The field is added as <input type="hidden" />

The default state is 'visible'.

Definition at line 61 of file Widget.py.

00061 
00062     def isVisible(self, instance, mode='view'):
00063         """decide if a field is visible in a given mode -> 'state'
00064 
00065         Return values are visible, hidden, invisible
00066 
00067         The value for the attribute on the field may either be a dict with a
00068         mapping for edit and view::
00069 
00070             visible = { 'edit' :'hidden', 'view' : 'invisible' }
00071 
00072         Or a single value for all modes::
00073 
00074             True/1:  'visible'
00075             False/0: 'invisible'
00076             -1:      'hidden'
00077             
00078         visible: The field is shown in the view/edit screen
00079         invisible: The field is skipped when rendering the view/edit screen
00080         hidden: The field is added as <input type="hidden" />
00081 
00082         The default state is 'visible'.
00083         """
00084         vis_dic = getattr(aq_base(self), 'visible', _marker)
00085         state = 'visible'
00086         if vis_dic is _marker:
00087             return state
00088         if type(vis_dic) is DictType:
00089             state = vis_dic.get(mode, state)
00090         elif not vis_dic:
00091             state = 'invisible'
00092         elif vis_dic < 0:
00093             state = 'hidden'
00094         return state

def Archetypes.Widget.TypesWidget.populateProps (   self,
  field 
) [inherited]
This is called when the field is created.

Definition at line 54 of file Widget.py.

00054 
00055     def populateProps(self, field):
00056         """This is called when the field is created."""
00057         name = field.getName()
00058         if not self.label:
00059             self.label = capitalize(name)

def Archetypes.Widget.TextAreaWidget.process_form (   self,
  instance,
  field,
  form,
  empty_marker = None,
  emptyReturnsMarker = False,
  validating = True 
) [inherited]
handle text formatting

Reimplemented from Archetypes.Widget.TypesWidget.

Definition at line 338 of file Widget.py.

00338 
00339                      emptyReturnsMarker=False, validating=True):
00340         """handle text formatting"""
00341         text_format = None
00342         value = None
00343         # text field with formatting
00344         value = form.get(field.getName(), empty_marker)
00345 
00346         if value is empty_marker:
00347             return empty_marker
00348 
00349         if emptyReturnsMarker and value == '':
00350             return empty_marker
00351 
00352         format_field = "%s_text_format" % field.getName()
00353         text_format = form.get(format_field, empty_marker)
00354         kwargs = {}
00355 
00356         if text_format is not empty_marker and text_format:
00357             kwargs['mimetype'] = text_format
00358 
00359         """ handle append_only """
00360         # Don't append if the existing data is empty or nothing was passed in
00361         if getattr(field.widget, 'append_only', None):
00362             if field.getEditAccessor(instance)():
00363                 if (value and not value.isspace()):
00364                     
00365                     divider = field.widget.divider
00366                     
00367                     # Add a datestamp along with divider if desired.
00368                     if getattr(field.widget, 'timestamp', None):
00369 
00370                         divider = "\n\n" + str(DateTime()) + divider
00371                         
00372                     # using default_output_type caused a recursive transformation
00373                     # that sucked, thus mimetype= here to keep it in line
00374                     value = value + divider + \
00375                             field.getEditAccessor(instance)()
00376                 else:
00377                     # keep historical entries
00378                     value = field.getEditAccessor(instance)()
00379         return value, kwargs

def Archetypes.Widget.TypesWidget.setCondition (   self,
  condition 
) [inherited]
Set the widget expression condition.

Definition at line 96 of file Widget.py.

00096 
00097     def setCondition(self, condition):
00098         """Set the widget expression condition."""
00099         self.condition = condition

def Archetypes.Widget.TypesWidget.testCondition (   self,
  folder,
  portal,
  object 
) [inherited]
Test the widget condition.

Definition at line 106 of file Widget.py.

00106 
00107     def testCondition(self, folder, portal, object):
00108         """Test the widget condition."""
00109         try:
00110             if self.condition:
00111                 __traceback_info__ = (folder, portal, object, self.condition)
00112                 ec = createExprContext(folder, portal, object)
00113                 return Expression(self.condition)(ec)
00114             else:
00115                 return True
00116         except AttributeError:
00117             return True

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

tuple Archetypes.Widget.EpozWidget._properties = TextAreaWidget._properties.copy() [static, private]

Reimplemented from Archetypes.Widget.TextAreaWidget.

Definition at line 750 of file Widget.py.

Definition at line 98 of file Widget.py.

Definition at line 58 of file Widget.py.

tuple Archetypes.Widget.EpozWidget.security = ClassSecurityInfo() [static]

Reimplemented from Archetypes.Widget.TextAreaWidget.

Definition at line 755 of file Widget.py.


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