B
    è¹`ð  ã               @   s@   d dl Z d dlmZ d dlmZ dd„ Zdd„ ZdZd	Zd
Z	dS )é    N)ÚHTTPNotFound)Úreraisec             C   s8   t  ¡ }y|  |¡}W n tk
r2   t|Ž  Y nX |S )N)ÚsysÚexc_infoZinvoke_exception_viewr   r   )ÚrequestÚexcr   Úresponse© r	   úV/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/pyramid/tweens.pyÚ_error_handler   s    r   c                s   ‡ fdd„}|S )aq  A :term:`tween` factory which produces a tween that catches an
    exception raised by downstream tweens (or the main Pyramid request
    handler) and, if possible, converts it into a Response using an
    :term:`exception view`.

    .. versionchanged:: 1.9
       The ``request.response`` will be remain unchanged even if the tween
       handles an exception. Previously it was deleted after handling an
       exception.

       Also, ``request.exception`` and ``request.exc_info`` are only set if
       the tween handles an exception and returns a response otherwise they
       are left at their original values.

    c          
      s>   yˆ | ƒ}W n, t k
r8 } zt| |ƒ}W d d }~X Y nX |S )N)Ú	Exceptionr   )r   r   r   )Úhandlerr	   r
   Úexcview_tween'   s
    z,excview_tween_factory.<locals>.excview_tweenr	   )r   Úregistryr   r	   )r   r
   Úexcview_tween_factory   s    r   ÚMAINÚINGRESSz$pyramid.tweens.excview_tween_factory)
r   Zpyramid.httpexceptionsr   Zpyramid.utilr   r   r   r   r   ZEXCVIEWr	   r	   r	   r
   Ú<module>   s   