什么是XmlHttpRequestError内部服务器错误?

时间:2015-08-04 08:22:12

标签: json python-2.7 date onchange typeerror

我为on_change方法制作了一个方法,这是我的代码:

def onchange_date_start(self, cr, uid, ids, date_start, context=None):
    factor = 2
    date_1 = datetime.strptime(date_start, '%Y-%m-%d')
    date2 = date_1.date()
    end_date = datetime(date2.year,date2.month,date2.day) + relativedelta(months=+factor)
    e_date = end_date
    _logger.info("\n\t\t\t\tEND Date Final %s"%(str(e_date.date())))
    value = {"value":{"end_on" : e_date.date()}}
    return value

到目前为止,它正确地打印出我的e_date,但也出现了一个错误:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request.  Either the server is overloaded or there is an error in the application.</p>

这是终端所说的:

    raise TypeError(repr(o) + " is not JSON serializable")
TypeError: datetime.date(2015, 10, 18) is not JSON serializable

我犯了什么错误?

感谢您提供任何帮助/建议

0 个答案:

没有答案