Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes | Properties
MoinMoin.support.werkzeug.exceptions.BadGateway Class Reference
Inheritance diagram for MoinMoin.support.werkzeug.exceptions.BadGateway:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.werkzeug.exceptions.BadGateway:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def wrap
def name
def get_description
def get_body
def get_headers
def get_response
def __call__

Static Public Attributes

int code = 502
tuple description
tuple wrap = classmethod(wrap)

Properties

 name = property(name, doc=name.__doc__)

Detailed Description

*502* `Bad Gateway`

If you do proxying in your application you should return this status code
if you received an invalid response from the upstream server it accessed
in attempting to fulfill the request.

Definition at line 370 of file exceptions.py.


Member Function Documentation

def MoinMoin.support.werkzeug.exceptions.HTTPException.__call__ (   self,
  environ,
  start_response 
) [inherited]
Call the exception as WSGI application.

:param environ: the WSGI environment.
:param start_response: the response callable provided by the WSGI
               server.

Definition at line 132 of file exceptions.py.

00132 
00133     def __call__(self, environ, start_response):
00134         """Call the exception as WSGI application.
00135 
00136         :param environ: the WSGI environment.
00137         :param start_response: the response callable provided by the WSGI
00138                                server.
00139         """
00140         response = self.get_response(environ)
00141         return response(environ, start_response)
00142 

Here is the call graph for this function:

def MoinMoin.support.werkzeug.exceptions.HTTPException.get_body (   self,
  environ 
) [inherited]
Get the HTML body.

Definition at line 101 of file exceptions.py.

00101 
00102     def get_body(self, environ):
00103         """Get the HTML body."""
00104         return (
00105             '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">\n'
00106             '<title>%(code)s %(name)s</title>\n'
00107             '<h1>%(name)s</h1>\n'
00108             '%(description)s\n'
00109         ) % {
00110             'code':         self.code,
00111             'name':         escape(self.name),
00112             'description':  self.get_description(environ)
00113         }

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.exceptions.HTTPException.get_description (   self,
  environ 
) [inherited]
Get the description.

Reimplemented in MoinMoin.support.werkzeug.exceptions.MethodNotAllowed.

Definition at line 97 of file exceptions.py.

00097 
00098     def get_description(self, environ):
00099         """Get the description."""
00100         return self.description

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.exceptions.HTTPException.get_headers (   self,
  environ 
) [inherited]
Get a list of headers.

Reimplemented in MoinMoin.support.werkzeug.exceptions.MethodNotAllowed.

Definition at line 114 of file exceptions.py.

00114 
00115     def get_headers(self, environ):
00116         """Get a list of headers."""
00117         return [('Content-Type', 'text/html')]

Here is the caller graph for this function:

def MoinMoin.support.werkzeug.exceptions.HTTPException.get_response (   self,
  environ 
) [inherited]
Get a response object.

:param environ: the environ for the request.
:return: a :class:`BaseResponse` object or a subclass thereof.

Reimplemented in MoinMoin.support.werkzeug.exceptions._ProxyException.

Definition at line 118 of file exceptions.py.

00118 
00119     def get_response(self, environ):
00120         """Get a response object.
00121 
00122         :param environ: the environ for the request.
00123         :return: a :class:`BaseResponse` object or a subclass thereof.
00124         """
00125         # lazyly imported for various reasons.  For one can use the exceptions
00126         # with custom responses (testing exception instances against types) and
00127         # so we don't ever have to import the wrappers, but also because there
00128         # are ciruclar dependencies when bootstrapping the module.
00129         from werkzeug.wrappers import BaseResponse
00130         headers = self.get_headers(environ)
00131         return BaseResponse(self.get_body(environ), self.code, headers)

Here is the call graph for this function:

Here is the caller graph for this function:

The status name.

Definition at line 92 of file exceptions.py.

00092 
00093     def name(self):
00094         """The status name."""
        return HTTP_STATUS_CODES[self.code]
def MoinMoin.support.werkzeug.exceptions.HTTPException.wrap (   cls,
  exception,
  name = None 
) [inherited]
This method returns a new subclass of the exception provided that
also is a subclass of `BadRequest`.

Definition at line 78 of file exceptions.py.

00078 
00079     def wrap(cls, exception, name=None):
00080         """
00081         This method returns a new subclass of the exception provided that
00082         also is a subclass of `BadRequest`.
00083         """
00084         class newcls(cls, exception):
00085             def __init__(self, arg=None, description=None):
00086                 cls.__init__(self, description)
00087                 exception.__init__(self, arg)
00088         newcls.__module__ = sys._getframe(1).f_globals.get('__name__')
00089         newcls.__name__ = name or cls.__name__ + exception.__name__
        return newcls

Here is the call graph for this function:


Member Data Documentation

Reimplemented from MoinMoin.support.werkzeug.exceptions.HTTPException.

Definition at line 377 of file exceptions.py.

Initial value:
(
        '<p>The proxy server received an invalid response from an upstream '
        'server.</p>'
    )

Reimplemented from MoinMoin.support.werkzeug.exceptions.HTTPException.

Definition at line 378 of file exceptions.py.

tuple MoinMoin.support.werkzeug.exceptions.HTTPException.wrap = classmethod(wrap) [static, inherited]

Definition at line 90 of file exceptions.py.


Property Documentation

MoinMoin.support.werkzeug.exceptions.HTTPException.name = property(name, doc=name.__doc__) [static, inherited]

Definition at line 95 of file exceptions.py.


The documentation for this class was generated from the following file: