Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Static Private Attributes
Archetypes.Widget.FileWidget Class Reference
Inheritance diagram for Archetypes.Widget.FileWidget:
Inheritance graph
[legend]
Collaboration diagram for Archetypes.Widget.FileWidget:
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 = TypesWidget._properties.copy()

Detailed Description

Definition at line 528 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.FileWidget.process_form (   self,
  instance,
  field,
  form,
  empty_marker = None,
  emptyReturnsMarker = False,
  validating = True 
)
form processing that deals with binary data

Reimplemented from Archetypes.Widget.TypesWidget.

Reimplemented in Archetypes.Widget.ImageWidget.

Definition at line 539 of file Widget.py.

00539 
00540                      emptyReturnsMarker=False, validating=True):
00541         """form processing that deals with binary data"""
00542 
00543         delete = form.get('%s_delete' % field.getName(), empty_marker)
00544         if delete=='delete': return "DELETE_FILE", {}
00545         if delete=='nochange' : return empty_marker
00546 
00547         value = None
00548 
00549         fileobj = form.get('%s_file' % field.getName(), empty_marker)
00550 
00551         if fileobj is empty_marker: return empty_marker
00552 
00553         filename = getattr(fileobj, 'filename', '')
00554         if not filename:
00555             filename = getattr(fileobj, 'name', '')
00556 
00557         if filename:
00558             value = fileobj
00559 
00560         if not value: return None
00561 
00562         return value, {}
00563 

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.FileWidget._properties = TypesWidget._properties.copy() [static, private]

Reimplemented from Archetypes.Widget.TypesWidget.

Reimplemented in Archetypes.Widget.ImageWidget.

Definition at line 529 of file Widget.py.

Definition at line 98 of file Widget.py.

Definition at line 58 of file Widget.py.

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

Reimplemented from Archetypes.Widget.TypesWidget.

Reimplemented in Archetypes.Widget.ImageWidget.

Definition at line 535 of file Widget.py.


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