def _convert_time(self, key): val = self.data.get(key, None) if not val: return numeric = None # the client will send things back as ints if self.form_mode == 'client': try: numeric = int(val) except ValueError: pass # otherwise, parse as formatted strings if not numeric: err = None parsed = None try: parsed = parse_date_time(val) except ValueError, e: err = str(e) if val is not None and parsed is None: err = 'Unable to read as date : %s, please format as yyyy-mm-dd' % val if err: self._my_errors[key] = err if parsed: numeric = int(datetime_to_seconds(parsed))
def set_end(self, val): self.end_time = parse_date_time(val)
def set_start(self, val): self.start_time = parse_date_time(val)