
    kh                     N    d dl Z d dlmZ  e j                    Zde_        ddZdS )    N)WSGIHandler  c                 J   	 t          |j        j        j                            d          t
                    r|t          _        nt          j        rt          j        }n# t          $ r Y nw xY w	 |
 |            }|j	        |ur|
                    |          |# d}d}w xY w)a  
    Alternative function for django.views.debug.technical_500_response.

    Django's convert_exception_to_response() wrapper is called on each 'Middleware' object to avoid
    leaking exceptions. If an uncaught exception is raised, the wrapper calls technical_500_response()
    to create a response for django's debug view.

    Runserver_plus overrides the django debug view's technical_500_response() function to allow for
    an enhanced WSGI debugger view to be displayed. However, because Django calls
    convert_exception_to_response() on each object in the stack of Middleware objects, re-raising an
    error quickly pollutes the traceback displayed.

    Runserver_plus only needs needs traceback frames relevant to WSGIHandler Middleware objects, so
    only store the traceback if it is for a WSGIHandler. If an exception is not raised here, Django
    eventually throws an error for not getting a valid response object for its debug view.
    selfN)
isinstancetb_nexttb_framef_localsgetr   tldwsgi_tbAttributeError__traceback__with_traceback)requestexc_type	exc_valuetbstatus_codes        f/var/www/histauto/venv/lib/python3.11/site-packages/django_extensions/management/technical_response.pynull_technical_500_responser   
   s    " bj)266v>>LL 	CKK[ 	B    

I"",,**2...					s   AA 
A,+A,0,B B")r   )	threadingdjango.core.handlers.wsgir   localr   r   r        r   <module>r      sW        1 1 1 1 1 1io# # # # # #r   