def _custom_field_default(self, field):
        default = field.get('value')
        options = field.get('options')
        if default and options and default not in options:
            try:
                default = options[int(default)]
            except (ValueError, __HOLE__):
                self.env.log.warning('Invalid default value "%s" '
                                     'for custom field "%s"',
                                     default, field['name'])
        if default and field.get('type') == 'time':
            try:
                default = parse_date(default,
                                     hint=field.get('format'))
            except TracError as e:
                self.env.log.warning('Invalid default value "%s" '
                                     'for custom field "%s": %s',
                                     default, field['name'], e)
                default = None
        return default
dataset/ETHPy150Open edgewall/trac/trac/ticket/model.py/Ticket._custom_field_default