Skip to content

Instantly share code, notes, and snippets.

@moschlar
Created June 5, 2012 13:44
Show Gist options
  • Save moschlar/2875069 to your computer and use it in GitHub Desktop.
Save moschlar/2875069 to your computer and use it in GitHub Desktop.
ToscaWidgets 2 Bootstrap - CalendarDateTimePicker
class CalendarDateTimePicker(Bootstrap, twc.CompoundWidget):
resources = set(CalendarDatePicker.resources + CalendarTimePicker.resources)
date = CalendarDatePicker()
time = CalendarTimePicker()
def _validate(self, value, state=None):
"""
Inner validation method; this is called by validate and should not be
called directly. Overriding this method in widgets is discouraged; a
custom validator should be coded instead. However, in some
circumstances overriding is necessary.
"""
self._validated = True
log.warn(value)
result = ''
for c in self.children:
log.warn(c)
d = value.get(c.key, '') # --> value is a string, so no attribute get
# log.warn(d)
# result += c._validate(value)
# child_value = field.validator.to_python(field.value)
# field.validator.validate_python(child_value, state)
# result += child_value
return result
def prepare(self):
super(CalendarDateTimePicker, self).prepare()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment