base.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:python-mysql-pool 作者: LuciferJack 项目源码 文件源码
def _DATETIME_to_python(self, value, dsc=None):
        """Connector/Python always returns naive datetime.datetime

        Connector/Python always returns naive timestamps since MySQL has
        no time zone support. Since Django needs non-naive, we need to add
        the UTC time zone.

        Returns datetime.datetime()
        """
        if not value:
            return None
        dt = MySQLConverter._DATETIME_to_python(self, value)
        if dt is None:
            return None
        if settings.USE_TZ and timezone.is_naive(dt):
            dt = dt.replace(tzinfo=timezone.utc)
        return dt
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号