³ò
-e|Mc        
   @   s~  d  Z  d d k Z d d k l Z d d k l Z l Z l Z d d k l	 Z	 d d k
 l Z l Z l Z l Z d Z d Z d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d  „  ƒ  YZ d! e f d" „  ƒ  YZ d# e f d$ „  ƒ  YZ d% e f d& „  ƒ  YZ  d' e f d( „  ƒ  YZ! d) e f d* „  ƒ  YZ" d+ e f d, „  ƒ  YZ# d- e f d. „  ƒ  YZ$ d/ e f d0 „  ƒ  YZ% d1 e f d2 „  ƒ  YZ& d3 e f d4 „  ƒ  YZ' d5 e f d6 „  ƒ  YZ( d7 e f d8 „  ƒ  YZ) d9 e f d: „  ƒ  YZ* d; e f d< „  ƒ  YZ+ d= e f d> „  ƒ  YZ, d? e f d@ „  ƒ  YZ- dA e f dB „  ƒ  YZ. dC e f dD „  ƒ  YZ/ dE e f dF „  ƒ  YZ0 dG e0 f dH „  ƒ  YZ1 dI e0 f dJ „  ƒ  YZ2 dK e0 f dL „  ƒ  YZ3 dM e0 f dN „  ƒ  YZ4 dO e0 f dP „  ƒ  YZ5 dQ e0 f dR „  ƒ  YZ6 d	 d d g Z7 h  Z8 xn e9 ƒ  i: ƒ  D]] \ Z; Z< e= e< e> e i? f ƒ o8 e@ e< e ƒ o( e< iA o e< e8 e< iA <e7 iB e; ƒ qÏqÏWdS „  ZC dT eD f dU „  ƒ  YZE dV „  ZF d d dW „ ZH e7 iI dT dX g ƒ d S(Y   sÏ	  
HTTP Exception Middleware

This module processes Python exceptions that relate to HTTP exceptions
by defining a set of exceptions, all subclasses of HTTPException, and a
request handler (`middleware`) that catches these exceptions and turns
them into proper responses.

This module defines exceptions according to RFC 2068 [1]_ : codes with
100-300 are not really errors; 400's are client errors, and 500's are
server errors.  According to the WSGI specification [2]_ , the application
can call ``start_response`` more then once only under two conditions:
(a) the response has not yet been sent, or (b) if the second and
subsequent invocations of ``start_response`` have a valid ``exc_info``
argument obtained from ``sys.exc_info()``.  The WSGI specification then
requires the server or gateway to handle the case where content has been
sent and then an exception was encountered.

Exceptions in the 5xx range and those raised after ``start_response``
has been called are treated as serious errors and the ``exc_info`` is
filled-in with information needed for a lower level module to generate a
stack trace and log information.

Exception
  HTTPException
    HTTPRedirection
      * 300 - HTTPMultipleChoices
      * 301 - HTTPMovedPermanently
      * 302 - HTTPFound
      * 303 - HTTPSeeOther
      * 304 - HTTPNotModified
      * 305 - HTTPUseProxy
      * 306 - Unused (not implemented, obviously)
      * 307 - HTTPTemporaryRedirect
    HTTPError
      HTTPClientError
        * 400 - HTTPBadRequest
        * 401 - HTTPUnauthorized
        * 402 - HTTPPaymentRequired
        * 403 - HTTPForbidden
        * 404 - HTTPNotFound
        * 405 - HTTPMethodNotAllowed
        * 406 - HTTPNotAcceptable
        * 407 - HTTPProxyAuthenticationRequired
        * 408 - HTTPRequestTimeout
        * 409 - HTTPConfict
        * 410 - HTTPGone
        * 411 - HTTPLengthRequired
        * 412 - HTTPPreconditionFailed
        * 413 - HTTPRequestEntityTooLarge
        * 414 - HTTPRequestURITooLong
        * 415 - HTTPUnsupportedMediaType
        * 416 - HTTPRequestRangeNotSatisfiable
        * 417 - HTTPExpectationFailed
      HTTPServerError
        * 500 - HTTPInternalServerError
        * 501 - HTTPNotImplemented
        * 502 - HTTPBadGateway
        * 503 - HTTPServiceUnavailable
        * 504 - HTTPGatewayTimeout
        * 505 - HTTPVersionNotSupported

References:

.. [1] http://www.python.org/peps/pep-0333.html#error-handling
.. [2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5

iÿÿÿÿN(   t   catch_errors_app(   t
   has_headert   header_valuet   replace_header(   t   resolve_relative_url(   t
   strip_htmlt
   html_quotet   no_quotet   comment_quotes   WSGI Servers·   <html>
  <head><title>%(title)s</title></head>
  <body>
    <h1>%(title)s</h1>
    <p>%(body)s</p>
    <hr noshade>
    <div align="right">%(server)s</div>
  </body>
</html>
t   HTTPExceptionc           B   s•   e  Z d  Z d Z d Z d Z d Z d Z d Z	 d Z
 d d d d „ Z d d „ Z d „  Z d „  Z d „  Z d „  Z d d	 „ Z e Z d
 „  Z RS(   sé	  
    the HTTP exception base class

    This encapsulates an HTTP response that interrupts normal application
    flow; but one which is not necessarly an error condition. For
    example, codes in the 300's are exceptions in that they interrupt
    normal processing; however, they are not considered errors.

    This class is complicated by 4 factors:

      1. The content given to the exception may either be plain-text or
         as html-text.

      2. The template may want to have string-substitutions taken from
         the current ``environ`` or values from incoming headers. This
         is especially troublesome due to case sensitivity.

      3. The final output may either be text/plain or text/html
         mime-type as requested by the client application.

      4. Each exception has a default explanation, but those who
         raise exceptions may want to provide additional detail.

    Attributes:

       ``code``
           the HTTP status code for the exception

       ``title``
           remainder of the status line (stuff after the code)

       ``explanation``
           a plain-text explanation of the error message that is
           not subject to environment or header substitutions;
           it is accessible in the template via %(explanation)s

       ``detail``
           a plain-text message customization that is not subject
           to environment or header substitutions; accessible in
           the template via %(detail)s

       ``template``
           a content fragment (in HTML) used for environment and
           header substitution; the default template includes both
           the explanation and further detail provided in the
           message

       ``required_headers``
           a sequence of headers which are required for proper
           construction of the exception

    Parameters:

       ``detail``
         a plain-text override of the default ``detail``

       ``headers``
         a list of (k,v) header pairs

       ``comment``
         a plain-text additional information which is
         usually stripped/hidden for end-users

    To override the template (which is HTML content) or the plain-text
    explanation, one must subclass the given exception; or customize it
    after it has been created.  This particular breakdown of a message
    into explanation, detail and template allows both the creation of
    plain-text and html messages for various clients as well as
    error-free substitution of environment variables and headers.
    t    s6   %(explanation)s
<br/>%(detail)s
<!-- %(comment)s -->c      	   C   sQ  |  i  p
 t d ‚ t | t d  ƒ t f ƒ p t d | ‚ t | t d  ƒ t f ƒ p t d | ‚ t | t d  ƒ t f ƒ p t d | ‚ | p t ƒ  |  _ xE |  i	 D]: } | o t
 | | ƒ p t d |  i i | | f ‚ q¯ W| d  j	 o | |  _ n | d  j	 o | |  _ n t i |  d |  i  |  i |  i |  i f ƒ d  S(   Ns0   Do not directly instantiate abstract exceptions.s"   headers must be None or a list: %rs#   detail must be None or a string: %rs$   comment must be None or a string: %rs;   Exception %s must be passed the header %r (got headers: %r)s   %s %s
%s
%s
(   t   codet   AssertionErrort
   isinstancet   typet   Nonet   listt
   basestringt   tuplet   headerst   required_headersR   t	   __class__t   __name__t   detailt   commentt	   Exceptiont   __init__t   titlet   explanation(   t   selfR   R   R   t   req(    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR   ¯   s(    
 c   
      C   s  | p | } h  | |  i  ƒ d <| |  i ƒ d <| |  i ƒ d <} t i |  i j oo x* | i ƒ  D] \ } } | | ƒ | | <qi W|  i o4 x1 |  i D]" \ } } | | ƒ | | i ƒ  <q WqË n xD | i ƒ  D]6 \ } }	 t |	 t	 ƒ o |	 i
 d d ƒ | | <qØ qØ W| | S(   NR   R   R   t   utf8t   xmlcharrefreplace(   R   R   R   R	   t   templatet   itemsR   t   lowerR   t   unicodet   encode(
   R   t   environR!   t   escfunct   comment_escfunct   argst   kt   vt   keyt   value(    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt	   make_bodyÅ   s"     

 " c         C   s8   |  i  | t |  i ƒ t t ƒ } d |  i |  i | f S(   s,    text/plain representation of the exception s   %s %s
%s
(   R.   R   R!   R   R   R   R   (   R   R&   t   body(    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt   plainÕ   s    !c         C   sM   |  i  | |  i t t ƒ } t h  |  i d <|  i d <t d <| d <S(   s+    text/html representation of the exception R   R   t   serverR/   (   R.   R!   R   R   t   TEMPLATER   R   t   SERVER_NAME(   R   R&   R/   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt   htmlÚ   s    	c         C   sî   |  i  o t |  i  ƒ } n g  } d | i d d ƒ j p d | i d d ƒ j o# t | d d ƒ |  i | ƒ } n  t | d d ƒ |  i | ƒ } t | t ƒ o= | i d ƒ } t	 | d ƒ p d } t | d | d	 ƒ n | | f S(
   NR4   t   HTTP_ACCEPTR
   s   */*s   content-types	   text/htmls
   text/plainR   s   ; charset=utf8(
   R   R   t   getR   R4   R0   R   R$   R%   R   (   R   R&   R   t   contentt   cur_content_type(    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt   prepare_contentã   s"    
c         C   sV   d d k  l } |  i | ƒ \ } } | d |  i d | ƒ } | i i | ƒ | _ | S(   Niÿÿÿÿ(   t   WSGIResponseR   R7   (   t   paste.wsgiwrappersR:   R9   R   R   t   fromlist(   R   R&   R:   R   R7   t   resp(    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt   responseù   s
    c         C   s<   |  i  | ƒ \ } } | d |  i |  i f | | ƒ | g S(   s6   
        This exception as a WSGI application
        s   %s %s(   R9   R   R   (   R   R&   t   start_responset   exc_infoR   R7   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt   wsgi_application   s
    c         C   s   d |  i  i |  i |  i f S(   Ns   <%s %s; code=%s>(   R   R   R   R   (   R   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt   __repr__  s    N(    (   R   t
   __module__t   __doc__R   R   R   R   R   R   R!   R   R   R.   R0   R4   R9   R>   RA   t   __call__RB   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR	   _   s"   F					
t	   HTTPErrorc           B   s   e  Z d  Z RS(   sö   
    base class for status codes in the 400's and 500's

    This is an exception which indicates that an error has occurred,
    and that any work in progress should not be committed.  These are
    typically results in the 400's and 500's.
    (   R   RC   RD   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRF     s   t   HTTPRedirectionc           B   s   e  Z d  Z RS(   s  
    base class for 300's status code (redirections)

    This is an abstract base class for 3xx redirection.  It indicates
    that further action needs to be taken by the user agent in order
    to fulfill the request.  It does not necessarly signal an error
    condition.
    (   R   RC   RD   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRG   $  s   t	   _HTTPMovec           B   sY   e  Z d  Z d Z d Z d Z d d d d „ Z d d d d „ Z e	 e ƒ Z d „  Z
 RS(	   sÂ  
    redirections which require a Location field

    Since a 'Location' header is a required attribute of 301, 302, 303,
    305 and 307 (but not 304), this base class provides the mechanics to
    make this easy.  While this has the same parameters as HTTPException,
    if a location is not provided in the headers; it is assumed that the
    detail _is_ the location (this for backward compatibility, otherwise
    we'd add a new attribute).
    t   locations   The resource has been moved tosƒ   %(explanation)s <a href="%(location)s">%(location)s</a>;
you should be redirected automatically.
%(detail)s
<!-- %(comment)s -->c         C   s®   t  | t d  ƒ t f ƒ p t ‚ | p g  } t | d ƒ } | p# | } d } | i d | f ƒ n | p
 t d ‚ t i |  | | | ƒ | d  j	 o | |  _	 n d  S(   NRI   R
   sa   HTTPRedirection specified neither a location in the headers nor did it provide a detail argument.(
   R   R   R   R   R   R   t   appendRG   R   R   (   R   R   R   R   RI   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR   @  s    #c         C   sH   t  | | ƒ } | p g  } | i d | f ƒ |  d | d | d | ƒ S(   s   
        Create a redirect object with the dest_uri, which may be relative,
        considering it relative to the uri implied by the given environ.
        t   LocationR   R   R   (   R   RJ   (   t   clst   dest_uriR&   R   R   R   RI   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt   relative_redirectO  s    c         C   sI   xB |  i  D]' \ } } | i ƒ  d j o | Sq
 q
 Wt d |  ƒ ‚ d  S(   NRI   s   No location set for %s(   R   R#   t   KeyError(   R   t   nameR-   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRI   [  s
    
 (   s   locationN(   R   RC   RD   R   R   R!   R   R   RN   t   classmethodRI   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRH   .  s   

t   HTTPMultipleChoicesc           B   s   e  Z d  Z d Z RS(   i,  s   Multiple Choices(   R   RC   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRR   b  s   t   HTTPMovedPermanentlyc           B   s   e  Z d  Z d Z RS(   i-  s   Moved Permanently(   R   RC   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRS   f  s   t	   HTTPFoundc           B   s   e  Z d  Z d Z d Z RS(   i.  t   Founds   The resource was found at(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRT   j  s   t   HTTPSeeOtherc           B   s   e  Z d  Z d Z RS(   i/  s	   See Other(   R   RC   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRV   q  s   t   HTTPNotModifiedc           B   s,   e  Z d  Z d Z d Z d „  Z d „  Z RS(   i0  s   Not ModifiedR
   c         C   s   d S(   NR
   (    (   R   R&   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR0   ~  s    c         C   s   d S(   s+    text/html representation of the exception R
   (    (   R   R&   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR4   €  s    (   R   RC   R   R   t   messageR0   R4   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRW   u  s
   	t   HTTPUseProxyc           B   s   e  Z d  Z d Z d Z RS(   i1  s	   Use Proxys8   The resource must be accessed through a proxy located at(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRY   „  s   t   HTTPTemporaryRedirectc           B   s   e  Z d  Z d Z RS(   i3  s   Temporary Redirect(   R   RC   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRZ   Œ  s   t   HTTPClientErrorc           B   s    e  Z d  Z d Z d Z d Z RS(   s8  
    base class for the 400's, where the client is in-error

    This is an error condition in which the client is presumed to be
    in-error.  This is an expected problem, and thus is not considered
    a bug.  A server-side traceback is not warranted.  Unless specialized,
    this is a '400 Bad Request'
    i  s   Bad Requestsd   The server could not comply with the request since
it is either malformed or otherwise incorrect.
(   R   RC   RD   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR[   ›  s   t   HTTPBadRequestc           B   s   e  Z RS(    (   R   RC   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR\   ©  s   t   HTTPUnauthorizedc           B   s   e  Z d  Z d Z d Z RS(   i‘  t   Unauthorizedsì   This server could not verify that you are authorized to
access the document you requested.  Either you supplied the
wrong credentials (e.g., bad password), or your browser
does not understand how to supply the credentials required.
(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR]   ¬  s   t   HTTPPaymentRequiredc           B   s   e  Z d  Z d Z d Z RS(   i’  s   Payment Requireds(   Access was denied for financial reasons.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR_   µ  s   t   HTTPForbiddenc           B   s   e  Z d  Z d Z d Z RS(   i“  t	   Forbiddens#   Access was denied to this resource.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR`   º  s   t   HTTPNotFoundc           B   s   e  Z d  Z d Z d Z RS(   i”  s	   Not Founds    The resource could not be found.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRb   ¿  s   t   HTTPMethodNotAllowedc           B   s    e  Z d Z d Z d Z d Z RS(   t   allowi•  s   Method Not AllowedsK   The method %(REQUEST_METHOD)s is not allowed for this resource.
%(detail)s(   Rd   (   R   RC   R   R   R   R!   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRc   Ä  s   t   HTTPNotAcceptablec           B   s   e  Z d  Z d Z d Z RS(   i–  s   Not Acceptablesw   The resource could not be generated that was acceptable to your browser (content
of type %(HTTP_ACCEPT)s).
%(detail)s(   R   RC   R   R   R!   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRe   Ì  s   t   HTTPProxyAuthenticationRequiredc           B   s   e  Z d  Z d Z d Z RS(   i—  s   Proxy Authentication Requireds*   Authentication /w a local proxy is needed.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRf   Ô  s   t   HTTPRequestTimeoutc           B   s   e  Z d  Z d Z d Z RS(   i˜  s   Request TimeoutsH   The server has waited too long for the request to be sent by the client.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRg   Ù  s   t   HTTPConflictc           B   s   e  Z d  Z d Z d Z RS(   i™  t   Conflicts:   There was a conflict when trying to complete your request.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRh   ß  s   t   HTTPGonec           B   s   e  Z d  Z d Z d Z RS(   iš  t   GonesF   This resource is no longer available.  No forwarding address is given.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRj   å  s   t   HTTPLengthRequiredc           B   s   e  Z d  Z d Z d Z RS(   i›  s   Length Requireds   Content-Length header required.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRl   ë  s   t   HTTPPreconditionFailedc           B   s   e  Z d  Z d Z d Z RS(   iœ  s   Precondition Faileds   Request precondition failed.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRm   ð  s   t   HTTPRequestEntityTooLargec           B   s   e  Z d  Z d Z d Z RS(   i  s   Request Entity Too Larges7   The body of your request was too large for this server.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRn   õ  s   t   HTTPRequestURITooLongc           B   s   e  Z d  Z d Z d Z RS(   iž  s   Request-URI Too Longs-   The request URI was too long for this server.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRo   ú  s   t   HTTPUnsupportedMediaTypec           B   s   e  Z d  Z d Z d Z RS(   iŸ  s   Unsupported Media TypesT   The request media type %(CONTENT_TYPE)s is not supported by this server.
%(detail)s(   R   RC   R   R   R!   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRp   ÿ  s   t   HTTPRequestRangeNotSatisfiablec           B   s   e  Z d  Z d Z d Z RS(   i   s   Request Range Not Satisfiables%   The Range requested is not available.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRq     s   t   HTTPExpectationFailedc           B   s   e  Z d  Z d Z d Z RS(   i¡  s   Expectation Faileds   Expectation failed.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRr     s   t   HTTPServerErrorc           B   s    e  Z d  Z d Z d Z d Z RS(   sF  
    base class for the 500's, where the server is in-error

    This is an error condition in which the server is presumed to be
    in-error.  This is usually unexpected, and thus requires a traceback;
    ideally, opening a support ticket for the customer. Unless specialized,
    this is a '500 Internal Server Error'
    iô  s   Internal Server ErrorsU   The server has either erred or is incapable of performing
the requested operation.
(   R   RC   RD   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRs     s   t   HTTPInternalServerErrorc           B   s   e  Z RS(    (   R   RC   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRt   +  s   t   HTTPNotImplementedc           B   s   e  Z d  Z d Z d Z RS(   iõ  s   Not ImplementedsU   The request method %(REQUEST_METHOD)s is not implemented for this server.
%(detail)s(   R   RC   R   R   R!   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRu   .  s   t   HTTPBadGatewayc           B   s   e  Z d  Z d Z d Z RS(   iö  s   Bad Gateways   Bad gateway.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRv   5  s   t   HTTPServiceUnavailablec           B   s   e  Z d  Z d Z d Z RS(   i÷  s   Service UnavailablesF   The server is currently unavailable. Please try again at a later time.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRw   :  s   t   HTTPGatewayTimeoutc           B   s   e  Z d  Z d Z d Z RS(   iø  s   Gateway Timeouts   The gateway has timed out.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRx   @  s   t   HTTPVersionNotSupportedc           B   s   e  Z d  Z d Z d Z RS(   iù  s   HTTP Version Not Supporteds"   The HTTP version is not supported.(   R   RC   R   R   R   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRy   E  s   c         C   s   t  |  S(   N(   t   _exceptions(   R   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt   get_exceptionU  s    t   HTTPExceptionHandlerc           B   s#   e  Z d  Z d d „ Z d „  Z RS(   s  
    catches exceptions and turns them into proper HTTP responses

    This middleware catches any exceptions (which are subclasses of
    ``HTTPException``) and turns them into proper HTTP responses.
    Note if the headers have already been sent, the stack trace is
    always maintained as this indicates a programming error.

    Note that you must raise the exception before returning the
    app_iter, and you cannot use this with generator apps that don't
    raise an exception until after their app_iter is iterated over.
    c         C   sv   | p! | d j o | d j  p t  ‚ | d  j	 o# d d  k } | i d t d ƒ n | p d |  _ | |  _ d  S(   Nic   iX  iÿÿÿÿs4   The warning_level parameter is not used or supportedi   iô  (   R   R   t   warningst   warnt   DeprecationWarningt   warning_levelt   application(   R   R   R€   R}   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR   j  s    	c         C   s`   |  | d <| i  d g  ƒ i t ƒ y |  i | | ƒ SWn" t j
 o } | | | ƒ Sn Xd  S(   Ns   paste.httpexceptionss   paste.expected_exceptions(   t
   setdefaultRJ   R	   R   (   R   R&   R?   t   exc(    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyRE   t  s    
	N(   R   RC   RD   R   R   RE   (    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR|   \  s   
c          O   s,   d d  k  } | i d t d ƒ t |  | Ž  S(   Niÿÿÿÿs\   httpexceptions.middleware is deprecated; use make_middleware or HTTPExceptionHandler insteadi   (   R}   R~   R   t   make_middleware(   R)   t   kwR}   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyt
   middleware}  s    	
c         C   s'   | o t  | ƒ } n t |  d | ƒS(   s¤  
    ``httpexceptions`` middleware; this catches any
    ``paste.httpexceptions.HTTPException`` exceptions (exceptions like
    ``HTTPNotFound``, ``HTTPMovedPermanently``, etc) and turns them
    into proper HTTP responses.

    ``warning_level`` can be an integer corresponding to an HTTP code.
    Any code over that value will be passed 'up' the chain, potentially
    reported on by another piece of middleware.
    R€   (   t   intR|   (   t   appt   global_confR€   (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pyR„   …  s    R{   (J   RD   t   typest   paste.wsgilibR    t   paste.responseR   R   R   t   paste.requestR   t   paste.util.quotingR   R   R   R   R3   R2   R   R	   RF   RG   RH   RR   RS   RT   RV   RW   RY   RZ   R[   R\   R]   R_   R`   Rb   Rc   Re   Rf   Rg   Rh   Rj   Rl   Rm   Rn   Ro   Rp   Rq   Rr   Rs   Rt   Ru   Rv   Rw   Rx   Ry   t   __all__Rz   t   globalsR"   RP   R-   R   R   t	   ClassTypet
   issubclassR   RJ   R{   t   objectR|   R†   R   R„   t   extend(    (    (    sc   /afs/athena.mit.edu/user/x/a/xavid/Public/bazki/lib/Paste-1.7.5.1-py2.5.egg/paste/httpexceptions.pys   <module>J   st   "±
4	 
	!	