File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/tutorial/__pycache__/tut10_http_errors.cpython-310.pyc
Back
o ;j� � @ s� d Z ddlZddlZddlZej�e�Zej�ej� e� � e��ZG dd� de�Z ej� ej�e�d�ZedkrBeje � ed� dS dS )z� Tutorial: HTTP errors HTTPError is used to return an error response to the client. CherryPy has lots of options regarding how such errors are logged, displayed, and formatted. � Nc @ sV e Zd Zdej�ed�iZej dd� �Z ej dd� �Zej dd� �Zej d d � �Z dS )� HTTPErrorDemozerror_page.403zcustom_error.htmlc C s$ t jj}|rd}d| S d}d| S )NZoff�ona( <html><body> <p>Toggle tracebacks <a href="toggleTracebacks">%s</a></p> <p><a href="/doesNotExist">Click me; I'm a broken link!</a></p> <p> <a href="/error?code=403"> Use a custom error page from a file. </a> </p> <p>These errors are explicitly raised by the application:</p> <ul> <li><a href="/error?code=400">400</a></li> <li><a href="/error?code=401">401</a></li> <li><a href="/error?code=402">402</a></li> <li><a href="/error?code=500">500</a></li> </ul> <p><a href="/messageArg">You can also set the response body when you raise an error.</a></p> </body></html> )�cherrypy�request�show_tracebacks)�self� tracebacksZtrace� r �W/opt/saltstack/salt/lib/python3.10/site-packages/cherrypy/tutorial/tut10_http_errors.py�index s ���zHTTPErrorDemo.indexc C s$ t jj}t j�d| i� t �d��)Nzrequest.show_tracebacks�/)r r r �config�updateZHTTPRedirect)r r r r r �toggleTracebacks8 s zHTTPErrorDemo.toggleTracebacksc C s t j|d��)N)�status�r � HTTPError)r �coder r r �errorA s zHTTPErrorDemo.errorc C s d}t jd|d��)Nz�If you construct an HTTPError with a 'message' argument, it wil be placed on the error page (underneath the status line by default).i� )�messager )r r r r r � messageArgF s zHTTPErrorDemo.messageArgN)�__name__� __module__�__qualname__�os�path�join�curpathZ _cp_configr Zexposer r r r r r r r r s � r z tutorial.conf�__main__)r )�__doc__r Zos.pathr r �dirname�__file__ZlocalDir�normpathr �getcwdr �objectr Ztutconfr Z quickstartr r r r �<module> s :�
| ver. 1.4 |
Github
|
.
| PHP 8.2.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings