0x1949 Team - FAZEMRX - MANAGER
Edit File: _template_util.cpython-310.pyc
o ��f{ � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z m Z mZmZm Z mZmZmZmZmZmZ ddlmZmZ ddlmZ ddlmZ dd lmZ dd lmZ ddlm Z ddl!m"Z" dd l#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z*m+Z+ ddl,m-Z-m.Z.m/Z/ ddl0m1Z1m2Z2m3Z3m4Z4 ddl5m6Z6m7Z7m8Z8 dd� Z9de:de7de:fdd�Z;G dd� de(j<�Z=G dd� de=�Z>G dd � d e(j<�Z?G d!d"� d"e(j<�Z@G d#d$� d$e*�ZAG d%d&� d&e*�ZBG d'd(� d(e*�ZCG d)d*� d*e*�ZDG d+d,� d,�ZEd-ZFG d.d/� d/ejGejH�ZId0ee e eJf ded1 fd2d3�ZKee8�G d4d5� d5��ZLG d6d7� d7e*�ZMd8d9� ZNd:ZOe� ZPee8�G d;d<� d<��ZQee8�G d=d>� d>��ZRh d?�ZSG d@dA� dA�ZTeT� ZU B dIde7dCe6dDee: dEeee"gdFf deVf dGdH�ZWdS )JzG twisted.web.util and twisted.web.template merged to avoid cyclic deps � N)�OrderedDict��escape)�IO�Any�AnyStr�Callable�Dict�List�Mapping�Optional�Tuple�Union�cast)�handler�make_parser)�Locator)�implementer)�Deferred)�Logger)�urlpath)�Failure)�FilePath)�fullyQualifiedName)�resource)�Element�renderer)�Flattenable�flatten� flattenString)�CDATA�Comment�Tag�slot)�IRenderable�IRequest�ITemplateLoaderc C s dt | �� d�S )aK Wraps <pre> tags around some text and HTML-escape it. This is here since once twisted.web.html was deprecated it was hard to migrate the html.PRE from current code to twisted.web.template. For new code consider using twisted.web.template. @return: Escaped text wrapped in <pre> tags. @rtype: C{str} z<pre>z</pre>r )�text� r( �</usr/lib/python3/dist-packages/twisted/web/_template_util.py�_PRE, s r* �URL�request�returnc C sH t | t�s td��|�dd� |�| � ddt| �d���d�i }|S )a� Generate a redirect to the given location. @param URL: A L{bytes} giving the location to which to redirect. @param request: The request object to use to generate the redirect. @type request: L{IRequest<twisted.web.iweb.IRequest>} provider @raise TypeError: If the type of C{URL} a L{str} instead of L{bytes}. @return: A L{bytes} containing HTML which tries to convince the client agent to visit the new location even if it doesn't respect the I{FOUND} response code. This is intended to be returned from a render method, eg:: def render_GET(self, request): return redirectTo(b"http://example.com/", request) zURL must be bytess Content-Types text/html; charset=utf-8s� <html> <head> <meta http-equiv="refresh" content="0;URL=%(url)s"> </head> <body bgcolor="#FFFFFF" text="#000000"> <a href="%(url)s">click here</a> </body> </html> s url�utf-8)� isinstance�bytes� TypeError� setHeader�redirectr �decode�encode)r+ r, �contentr( r( r) � redirectTo; s ��r7 c s: e Zd ZdZdZdef� fdd�Zdd� Zdd � Z� Z S ) �Redirectz� Resource that redirects to a specific URL. @ivar url: Redirect target URL to put in the I{Location} response header. @type url: L{bytes} T�urlc s t � �� || _d S �N)�super�__init__r9 ��selfr9 �� __class__r( r) r<