HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/django/template/__pycache__/response.cpython-310.pyc
o

�aU�@sPddlmZddlmZmZGdd�de�ZGdd�de�ZGdd	�d	e�Zd
S)�)�HttpResponse�)�get_template�select_templatec@seZdZdS)�ContentNotRenderedErrorN)�__name__�
__module__�__qualname__�r
r
�:/usr/lib/python3/dist-packages/django/template/response.pyrsrcs�eZdZgd�Z		d�fdd�	Zdd�Zdd�Zd	d
�Zedd��Z	d
d�Z
dd�Zedd��Z�fdd�Z
e�fdd��Zejdd��Z�ZS)�SimpleTemplateResponse)�
template_name�context_data�_post_render_callbacksNcs>||_||_||_g|_d|_t�jd||||d�d|_dS)N�)�charset�headersF)r
r�usingr�_request�super�__init__�_is_rendered)�self�template�context�content_type�statusrrr��	__class__r
rr
s
zSimpleTemplateResponse.__init__cCs6|j��}|jstd��|jD]	}||vr||=q|S)z�
        Raise an exception if trying to pickle an unrendered response. Pickle
        only rendered data, not the data used to construct the response.
        z?The response content must be rendered before it can be pickled.)�__dict__�copyrr�rendering_attrs)r�obj_dict�attrr
r
r�__getstate__-s

�z#SimpleTemplateResponse.__getstate__cCs8t|ttf�rt||jd�St|t�rt||jd�S|S)z=Accept a template object, path-to-template, or list of paths.)r)�
isinstance�list�tuplerr�strr)rrr
r
r�resolve_template<s

z'SimpleTemplateResponse.resolve_templatecCs|S�Nr
)rrr
r
r�resolve_contextEsz&SimpleTemplateResponse.resolve_contextcCs&|�|j�}|�|j�}|�||j�S)a@Return the freshly rendered content for the template and context
        described by the TemplateResponse.

        This *does not* set the final content of the response. To set the
        response content, you must either call render(), or set the
        content explicitly using the value of this property.
        )r)r
r+r�renderr)rrrr
r
r�rendered_contentHs	z'SimpleTemplateResponse.rendered_contentcCs"|jr	||�dS|j�|�dS)z�Add a new post-rendering callback.

        If the response has already been rendered,
        invoke the callback immediately.
        N)rr�append)r�callbackr
r
r�add_post_render_callbackUsz/SimpleTemplateResponse.add_post_render_callbackcCs6|}|js|j|_|jD]}||�}|dur|}q|S)z�Render (thereby finalizing) the content of the response.

        If the content has already been rendered, this is a no-op.

        Return the baked response instance.
        N)rr-�contentr)r�retval�
post_callback�	newretvalr
r
rr,`s
�zSimpleTemplateResponse.rendercCs|jSr*)r�rr
r
r�is_renderedpsz"SimpleTemplateResponse.is_renderedcs|jstd��t���S)NzEThe response content must be rendered before it can be iterated over.)rrr�__iter__r5rr
rr7ts
�
zSimpleTemplateResponse.__iter__cs|jstd��t�jS)Nz@The response content must be rendered before it can be accessed.)rrrr1r5rr
rr1{s
�zSimpleTemplateResponse.contentcCstj�||�d|_dS)z!Set the content for the response.TN)rr1�fsetr)r�valuer
r
rr1�s
�NNNNNN)rrr	r!rr$r)r+�propertyr-r0r,r6r7r1�setter�
__classcell__r
r
rrr
s&� 	

rcs.eZdZejdgZ		d�fdd�	Z�ZS)�TemplateResponserNc			s$t�j|||||||d�||_dS)N)r)rrr)	r�requestrrrrrrrrr
rr�s
zTemplateResponse.__init__r:)rrr	rr!rr=r
r
rrr>�s
�r>N)	�django.httpr�loaderrr�	Exceptionrrr>r
r
r
r�<module>s