__init__.py 文件源码

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

项目:QualquerMerdaAPI 作者: tiagovizoto 项目源码 文件源码
def format_field(self, value, format_spec):
            if hasattr(value, '__html_format__'):
                rv = value.__html_format__(format_spec)
            elif hasattr(value, '__html__'):
                if format_spec:
                    raise ValueError('No format specification allowed '
                                     'when formatting an object with '
                                     'its __html__ method.')
                rv = value.__html__()
            else:
                # We need to make sure the format spec is unicode here as
                # otherwise the wrong callback methods are invoked.  For
                # instance a byte string there would invoke __str__ and
                # not __unicode__.
                rv = string.Formatter.format_field(
                    self, value, text_type(format_spec))
            return text_type(self.escape(rv))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号