Back to index

plone3  3.1.7
Classes | Functions | Variables
plone.app.controlpanel.widgets Namespace Reference

Classes

class  DropdownChoiceWidget
class  MultiCheckBoxVocabularyWidget
class  MultiCheckBoxColumnsWidget
class  MultiCheckBoxThreeColumnWidget
class  LanguageTableWidget
class  MultiSelectTupleWidget
class  AllowedTypesWidget

Functions

def WeekdayWidget

Variables

tuple WEEKDAYS

Function Documentation

def plone.app.controlpanel.widgets.WeekdayWidget (   field,
  request 
)
A widget for the selection of weekdays.

Definition at line 293 of file widgets.py.

00293 
00294 def WeekdayWidget(field, request):
00295     """A widget for the selection of weekdays."""
00296     weekdays = WEEKDAYS
00297     locale = None
00298     context = getattr(field, 'context', None)
00299     if context is not None:
00300         context = getattr(context, 'context', None)
00301         if context is not None:
00302             portal_state = getMultiAdapter((context, request),
00303                                            name=u'plone_portal_state')
00304             locale = portal_state.locale()
00305     if locale is not None:
00306         # We probably shouldn't assume a gregorian calendar here, but the rest
00307         # of our stack doesn't support anything else anyways for now.
00308         gregorian = locale.dates.calendars.get('gregorian')
00309         weekdays = tuple(zip(gregorian.getDayNames(), range(0, 8)))
00310 
00311     terms = [SimpleTerm(item[1], title=item[0]) for item in weekdays]
00312     return DropdownWidget(field, SimpleVocabulary(terms), request)
00313 


Variable Documentation

Initial value:
00001 (('Monday', 0),
00002             ('Tuesday', 1),
00003             ('Wednesday', 2),
00004             ('Thursday', 3),
00005             ('Friday', 4),
00006             ('Saturday', 5),
00007             ('Sunday', 6))

Definition at line 14 of file widgets.py.