当前位置: 首页>>代码示例>>Python>>正文


Python HTTPException.__init__方法代码示例

本文整理汇总了Python中werkzeug.exceptions.HTTPException.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPException.__init__方法的具体用法?Python HTTPException.__init__怎么用?Python HTTPException.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在werkzeug.exceptions.HTTPException的用法示例。


在下文中一共展示了HTTPException.__init__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, description=None, response=None):
        super(Exception, self).__init__()
        if description is not None:
            self.description = description
        self.response = response 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:7,代码来源:exceptions.py

示例2: wrap

# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def wrap(cls, exception, name=None):
        """Create an exception that is a subclass of the calling HTTP
        exception and the ``exception`` argument.

        The first argument to the class will be passed to the
        wrapped ``exception``, the rest to the HTTP exception. If
        ``self.args`` is not empty, the wrapped exception message is
        added to the HTTP exception description.

        .. versionchanged:: 0.15
            The description includes the wrapped exception message.
        """

        class newcls(cls, exception):
            def __init__(self, arg=None, *args, **kwargs):
                super(cls, self).__init__(*args, **kwargs)

                if arg is None:
                    exception.__init__(self)
                else:
                    exception.__init__(self, arg)

            def get_description(self, environ=None):
                out = super(cls, self).get_description(environ=environ)

                if self.args:
                    out += "<p><pre><code>{}: {}</code></pre></p>".format(
                        exception.__name__, escape(exception.__str__(self))
                    )

                return out

        newcls.__module__ = sys._getframe(1).f_globals.get("__name__")
        newcls.__name__ = name or cls.__name__ + exception.__name__
        return newcls 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:37,代码来源:exceptions.py

示例3: __init__

# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def __init__(self, description=None, response=None):
        Exception.__init__(self)
        if description is not None:
            self.description = description
        self.response = response 
开发者ID:jpush,项目名称:jbox,代码行数:7,代码来源:exceptions.py

示例4: wrap

# 需要导入模块: from werkzeug.exceptions import HTTPException [as 别名]
# 或者: from werkzeug.exceptions.HTTPException import __init__ [as 别名]
def wrap(cls, exception, name=None):
        """This method returns a new subclass of the exception provided that
        also is a subclass of `BadRequest`.
        """
        class newcls(cls, exception):

            def __init__(self, arg=None, *args, **kwargs):
                cls.__init__(self, *args, **kwargs)
                exception.__init__(self, arg)
        newcls.__module__ = sys._getframe(1).f_globals.get('__name__')
        newcls.__name__ = name or cls.__name__ + exception.__name__
        return newcls 
开发者ID:jpush,项目名称:jbox,代码行数:14,代码来源:exceptions.py


注:本文中的werkzeug.exceptions.HTTPException.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。