351 try: |
351 try: |
352 # (adim) I can't find a way to parse a Time with a custom format |
352 # (adim) I can't find a way to parse a Time with a custom format |
353 date = strptime(value, format) # this returns a DateTime |
353 date = strptime(value, format) # this returns a DateTime |
354 return time(date.hour, date.minute, date.second) |
354 return time(date.hour, date.minute, date.second) |
355 except ValueError: |
355 except ValueError: |
356 raise ValueError('can\'t parse %r (expected %s)' % (value, format)) |
356 raise ValueError(self._('can\'t parse %(value)r (expected %(format)s)') |
|
357 % {'value': value, 'format': format}) |
357 try: |
358 try: |
358 format = self.property_value('ui.date-format') |
359 format = self.property_value('ui.date-format') |
359 dt = strptime(value, format) |
360 dt = strptime(value, format) |
360 if etype == 'Datetime': |
361 if etype == 'Datetime': |
361 return todatetime(dt) |
362 return todatetime(dt) |
362 return todate(dt) |
363 return todate(dt) |
363 except ValueError: |
364 except ValueError: |
364 raise ValueError('can\'t parse %r (expected %s)' % (value, format)) |
365 raise ValueError(self._('can\'t parse %(value)r (expected %(format)s)') |
|
366 % {'value': value, 'format': format}) |
365 |
367 |
366 # abstract methods to override according to the web front-end ############# |
368 # abstract methods to override according to the web front-end ############# |
367 |
369 |
368 def base_url(self): |
370 def base_url(self): |
369 """return the root url of the instance""" |
371 """return the root url of the instance""" |