HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/django/forms/__pycache__/utils.cpython-310.pyc
o

�h��@sddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZmZdd	lmZdd
lmZddlmZdd
�Zdd�Zde�ZGdd�d�ZGdd�de�ZGdd�de�ZGdd�dee�ZGdd�dee e�Z!dd�Z"dd�Z#dS)�N)�UserList)�settings)�ValidationError)�get_default_renderer)�timezone)�RemovedInDjango50Warning)�escape�format_html_join)�	mark_safe)�gettext_lazy)�get_docs_versioncCs|sdS|�dd���S)z%Convert 'first_name' to 'First name'.��_� )�replace�
capitalize)�name�r�E/usr/local/CyberCP/lib/python3.10/site-packages/django/forms/utils.py�pretty_namesrcCslg}g}|��D]\}}t|t�r|r|�|f�q|dur%|�||f�qtddt|��tddt|��S)a�
    Convert a dictionary of attributes to a single string.
    The returned string will contain a leading space followed by key="value",
    XML-style pairs. In the case of a boolean value, the key will appear
    without a value. It is assumed that the keys do not need to be
    XML-escaped. If the passed dictionary is empty, then return an empty
    string.

    The result is passed through 'mark_safe' (by way of 'format_html_join').
    Nr
z {}="{}"z {})�items�
isinstance�bool�appendr	�sorted)�attrs�key_value_attrs�
boolean_attrs�attr�valuerrr�flatatts
��
�r agThe "default.html" templates for forms and formsets will be removed. These were proxies to the equivalent "table.html" templates, but the new "div.html" templates will be the default from Django 5.0. Transitional renderers are provided to allow you to opt-in to the new output style now. See https://docs.djangoproject.com/en/%s/releases/4.1/ for more detailsc@s&eZdZdd�Zddd�ZeZeZdS)�RenderableMixincCstd��)NzBSubclasses of RenderableMixin must provide a get_context() method.)�NotImplementedError��selfrrr�get_context;s�zRenderableMixin.get_contextNcCsP|p|j}|p	|j}|p|��}|dks|dkr tjttdd�t|�||��S)Nzdjango/forms/default.htmlz"django/forms/formsets/default.html�)�
stacklevel)	�renderer�
template_namer%�warnings�warn� DEFAULT_TEMPLATE_DEPRECATION_MSGrr
�render)r$r)�contextr(�templaterrrr-@s

�zRenderableMixin.render�NNN)�__name__�
__module__�__qualname__r%r-�__str__�__html__rrrrr!:s


r!c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�RenderableFormMixincC�|�|j�S)zRender as <p> elements.)r-�template_name_pr#rrr�as_pR�zRenderableFormMixin.as_pcCr7)z>Render as <tr> elements excluding the surrounding <table> tag.)r-�template_name_tabler#rrr�as_tableVr:zRenderableFormMixin.as_tablecCr7)z;Render as <li> elements excluding the surrounding <ul> tag.�r-�template_name_ulr#rrr�as_ulZr:zRenderableFormMixin.as_ulcCr7)zRender as <div> elements.)r-�template_name_divr#rrr�as_div^r:zRenderableFormMixin.as_divN)r1r2r3r9r<r?rArrrrr6Qs
r6c@s&eZdZd	dd�Zdd�Zdd�ZdS)
�RenderableErrorMixinFcCst�|�|��S�N)�json�dumps�
get_json_data�r$�escape_htmlrrr�as_jsondszRenderableErrorMixin.as_jsoncCr7rC)r-�template_name_textr#rrr�as_textg�zRenderableErrorMixin.as_textcCr7rCr=r#rrrr?jrLzRenderableErrorMixin.as_ulN�F)r1r2r3rIrKr?rrrrrBcs
rBcsLeZdZdZdZdZdZdd��fdd�
Zd	d
�Zddd
�Z	dd�Z
�ZS)�	ErrorDictz�
    A collection of errors that knows how to display itself in various formats.

    The dictionary keys are the field names, and the values are the errors.
    z%django/forms/errors/dict/default.htmlz!django/forms/errors/dict/text.txtz django/forms/errors/dict/ul.htmlN)r(cs"t�j|i|��|p
t�|_dSrC)�super�__init__rr()r$r(�args�kwargs��	__class__rrrPyszErrorDict.__init__cCsdd�|��D�S)NcSsi|]	\}}||���qSr)�as_data��.0�f�errr�
<dictcomp>~sz%ErrorDict.as_data.<locals>.<dictcomp>�rr#rrrrU}szErrorDict.as_dataFcs�fdd�|��D�S)Ncsi|]
\}}||����qSr)rFrV�rHrrrZ�sz+ErrorDict.get_json_data.<locals>.<dictcomp>r[rGrr\rrF�szErrorDict.get_json_datacCs|��dd�S)N�	errorlist��errors�error_classr[r#rrrr%�s�zErrorDict.get_contextrM)r1r2r3�__doc__r)rJr>rPrUrFr%�
__classcell__rrrSrrNns
rNcs�eZdZdZdZdZdZd�fdd�	Zdd	�Z�fd
d�Z	dd
d�Z
dd�Zdd�Zdd�Z
dd�Zdd�Z�fdd�Z�ZS)�	ErrorListzU
    A collection of errors that knows how to display itself in various formats.
    z%django/forms/errors/list/default.htmlz!django/forms/errors/list/text.txtz django/forms/errors/list/ul.htmlNcs8t��|�|durd|_nd�|�|_|pt�|_dS)Nr]zerrorlist {})rOrPr`�formatrr()r$�initlistr`r(rSrrrP�s
zErrorList.__init__cCst|j�jSrC)r�data�
error_listr#rrrrU�rLzErrorList.as_datacst���}|j|_|SrC)rO�copyr`)r$rhrSrrrh�s
zErrorList.copyFcCsDg}|��D]}tt|��}|�|rt|�n||jpdd��q|S)Nr
)�message�code)rU�next�iterrrrj)r$rHr_�errorrirrrrF�s��zErrorList.get_json_datacCs||jd�S)Nr^)r`r#rrrr%�s�zErrorList.get_contextcCstt|��SrC)�repr�listr#rrr�__repr__�rLzErrorList.__repr__cCs|t|�vSrC�ro)r$�itemrrr�__contains__�rLzErrorList.__contains__cCst|�|kSrCrq)r$�otherrrr�__eq__�rLzErrorList.__eq__cCs$|j|}t|t�rtt|��S|SrC)rfrrrkrl)r$�irmrrr�__getitem__�s

zErrorList.__getitem__cs&tt|�j|i|��}|dd�dS)N�)NN)rOr�
__reduce_ex__)r$rQrR�inforSrrry�szErrorList.__reduce_ex__r0rM)r1r2r3rar)rJr>rPrUrhrFr%rprsrurwryrbrrrSrrc�s	
rcc
Cs�tjr@|dur@t�|�r@t��}zt�|�s t�||�r td��t�||�WSt	y?}z
t
td�d||d�d�|�d}~ww|S)z}
    When time zone support is enabled, convert naive datetimes
    entered in the current time zone to aware datetimes.
    NzAmbiguous or non-existent time.ur%(datetime)s couldn’t be interpreted in time zone %(current_timezone)s; it may be ambiguous or it may not exist.�ambiguous_timezone)�datetime�current_timezone)rj�params)r�USE_TZr�is_naive�get_current_timezone�
_is_pytz_zone� _datetime_ambiguous_or_imaginary�
ValueError�
make_aware�	Exceptionrr)rr}�excrrr�from_current_timezone�s.�
������
r�cCs&tjr|durt�|�rt�|�S|S)z�
    When time zone support is enabled, convert aware datetimes
    to naive datetimes in the current time zone for display.
    N)rrr�is_aware�
make_naive)rrrr�to_current_timezone�s
r�)$rDr*�collectionsr�django.confr�django.core.exceptionsr�django.forms.renderersr�django.utilsr�django.utils.deprecationr�django.utils.htmlrr	�django.utils.safestringr
�django.utils.translationrr�django.utils.versionrrr r,r!r6rB�dictrNrorcr�r�rrrr�<module>s2��
H