403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/django/core/management/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/django/core/management/__pycache__/templates.cpython-311.pyc
�

�|�eU5����ddlZddlZddlZddlZddlZddlZddlZddlmZddl	m
Z
ddlZddlm
Z
ddlmZmZddlmZddlmZmZddlmZdd	lmZGd
�de��ZdS)�N)�
import_module)�urlretrieve)�settings)�BaseCommand�CommandError)�handle_extensions)�Context�Engine)�archive)�get_docs_versionc�\�eZdZdZgZgd�ZdZd�Zdd�Zd�Z	dd	�Z
d
�Zd�Zd�Z
d
�Zd�ZdS)�TemplateCommanda�
    Copy either a Django application layout template or a Django project
    layout template into the specified directory.

    :param style: A color style object (see django.core.management.color).
    :param app_or_project: The string 'app' or 'project'.
    :param name: The name of the application or project.
    :param directory: The directory to which the template should be copied.
    :param options: The additional variables passed to project or app templates
    )�http�https�ftp))z.py-tplz.pyc��|�dd���|�ddd���|�dd	���|�d
ddd
dgd���|�dddd
gd���dS)N�namez#Name of the application or project.)�help�	directory�?zOptional destination directory)�nargsrz
--templatez*The path or URL to load the template from.z--extensionz-e�
extensions�append�pyztThe file extension(s) to render (default: "py"). Separate multiple extensions with commas, or use -e multiple times.)�dest�action�defaultrz--namez-n�filesz_The file name(s) to render. Separate multiple file names with commas, or use -n multiple times.)�add_argument)�self�parsers  �B/usr/lib/python3/dist-packages/django/core/management/templates.py�
add_argumentszTemplateCommand.add_arguments(s������F�)N��O�O�O����K�s�9Y��Z�Z�Z����L�/[��\�\�\�����4�l��d�V�&�	�	
�	
�	
�	����d���R�:�	�	
�	
�	
�	
�	
�Nc
�T
�||_|dkrdnd|_g|_|d|_|�|��|��t
j�tj��|��}	tj	|��n�#t$rtd|z���t$r}t|���d}~wwxYw|dkr3|�t
j�
|��d��t
j�t
j�|����}t
j�|��std|z���t#t%|d����}g}|d	D]9}	|�t)d
�|	�d�������:|jdkrf|j�d
|�dd�|������|j�d
|�dd�|������d|z}
d|z}d|z}d|z}
d�d�|���D����}t3i|�|
||||
|dt5��dt6ji�d���}t:js&t;j��t7j ��|�!|d|��}tE|��dz}tj#|��D�]�\}}}||d�}|�$|
|��}|r6t
j�||��}tj	|d���|dd�D]2}|�%d��s|d kr|�&|���3|D�]V}|�'d!��r�t
j�||��}t
j�|||�$|
|����}|j(D]7\}}|�'|��r|dtE|���|z}n�8t
j�|��rt|�d"|j�d#|�d$����|�'|��s||vr�tS|d%�&��5}|�*��}ddd��n#1swxYwYtW���,|��} | �-|��}tS|d'd%�&��5}!|!�|��ddd��n#1swxYwYnt]j/||��|jdkr|j�d(|z��	t]j0||��|�1|����#t$r,|j2�d)|z|j3j4��Y��TwxYw���|jrw|jdkr|j�d*��|jD]L}"t
j�5|"��rtj&|"���6t]j6|"���KdSdS)+N�app�an�a�	verbosityz'%s' already existsrzBDestination directory '%s' does not exist, please create it first.rrc�*�|���S�N)�strip)�xs r"�<lambda>z(TemplateCommand.handle.<locals>.<lambda>Vs��Q�W�W�Y�Y�r$�,�z
Rendering z! template files with extensions: z, z  template files with filenames: z%s_namez%s_templatez%s_directoryzcamel_case_%s_name�c3�&K�|]}|dk�|V��
dS)�_N�)�.0r-s  r"�	<genexpr>z)TemplateCommand.handle.<locals>.<genexpr>ds&����"G�"G��a�3�h�h�1�h�h�h�h�"G�"Gr$�docs_version�django_versionF)�
autoescape�template�T)�exist_ok�.�__pycache__)z.pyoz.pycz	.py.classz already exists. Overlaying � z< into an existing directory won't replace conflicting files.zutf-8)�encoding�wzCreating %szkNotice: Couldn't set permission bits on %s. You're probably using an uncommon filesystem setup. No problem.zCleaning up temporary files.)7�app_or_project�a_or_an�paths_to_remover)�
validate_name�os�path�join�getcwd�makedirs�FileExistsErrorr�OSError�basename�abspath�
expanduser�exists�tupler�extend�map�split�stdout�write�titler	r�django�__version__r�
configured�	configure�setup�handle_template�len�walk�replace�
startswith�remove�endswith�rewrite_template_suffixes�open�readr
�from_string�render�shutil�copyfile�copymode�make_writeable�stderr�style�NOTICE�isfile�rmtree)#r rBr�target�options�top_dir�er�extra_files�file�	base_name�base_subdir�base_directory�camel_case_name�camel_case_value�context�template_dir�
prefix_length�root�dirsr�	path_rest�relative_dir�
target_dir�dirname�filename�old_path�new_path�
old_suffix�
new_suffix�
template_file�contentr:�new_file�path_to_removes#                                   r"�handlezTemplateCommand.handle:s���,���-��6�6�t�t�C���!��� ��-������4� � � ��>��g�l�l�2�9�;�;��5�5�G�
&���G�$�$�$�$��"�
D�
D�
D�"�#8�7�#B�C�C�C��
&�
&�
&�"�1�o�o�%�����
&������&�&��"�"�2�7�#3�#3�F�#;�#;�[�I�I�I��g�o�o�b�g�&8�&8��&@�&@�A�A�G��7�>�>�'�*�*�
O�"�$D�FM�$N�O�O�O��,�W�\�-B�C�C�D�D�
����G�$�	J�	J�D����s�#6�#6��
�
�3���H�H�I�I�I�I��>�Q����K����!�>�>�4�9�9�Z�#8�#8�#8�:�
�
�
�
�K����!�>�>�4�9�9�[�#9�#9�#9�;�
�
�
���.�	�#�n�4��'�.�8��.��?���7�7�"G�"G�d�j�j�l�l�"G�"G�"G�G�G���
��
��t��G��-��,�.�.��f�0�

�
�������"�	��� � � ��L�N�N�N��+�+�G�J�,?�,7�9�9���L�)�)�A�-�
�!#���!6�!6�6	B�6	B��D�$���]�^�^�,�I�$�,�,�Y��=�=�L��
7��W�\�\�'�<�@�@�
���J��6�6�6�6�����7�
)�
)���%�%�c�*�*�)�g��.F�.F��K�K��(�(�(��!�*
B�*
B���$�$�%B�C�C����7�<�<��h�7�7���7�<�<��\�8�+;�+;�I�t�+L�+L����/3�.L���*�J�
��(�(��4�4��#+�,=�c�*�o�o�-=�,=�#>��#K������7�>�>�(�+�+��&�%�H�H�d�l�l�l�N�N�N������$�$�Z�0�0�8�H��4K�4K��h��9�9�9�7�]�"/�"4�"4�"6�"6��7�7�7�7�7�7�7�7�7�7�7����7�7�7�7�%�x�x�3�3�G�<�<�H�&�o�o�g�6�6�G��h��g�>�>�>�0�(� ���w�/�/�/�0�0�0�0�0�0�0�0�0�0�0����0�0�0�0���O�H�h�7�7�7��>�Q�&�&��K�%�%�m�h�&>�?�?�?�B��O�H�h�7�7�7��'�'��1�1�1�1���B�B�B��K�%�%�#�%-�.�/3�z�/@�B�B�B�B�B�B����M*
B�X��	2��~��"�"���!�!�"@�A�A�A�"&�"6�
2�
2���7�>�>�.�1�1�2��I�n�-�-�-�-��M�.�1�1�1�1�	2�	2�
2�
2sN�4B	�	%C�.B=�=C�!T�T�	T�U7�7U;�>U;�*W-�-2X#�"X#c��|�1tj�tjdd|��S|�d��r
|dd�}tj�|��}tj�|��}tj�|��r|S|�	|��r|�
|��}ntj�|��}tj�|��r|�
|��Std|j�d|�d����)	z�
        Determine where the app or project templates are.
        Use django.__path__[0] as the default because the Django install
        directory isn't known.
        Nr�confzfile://�zcouldn't handle z
 template r=)rFrGrHrX�__path__rarO�normpath�isdir�is_url�downloadrNrP�extractrrB)r r:�subdir�expanded_template�
absolute_paths     r"r]zTemplateCommand.handle_template�s%�����7�<�<���� 2�F�F�C�C�C��"�"�9�-�-�
(�#�A�B�B�<�� "�� 2� 2�8� <� <�� "�� 0� 0�1B� C� C���w�}�}�.�/�/�
)�(�(��{�{�8�$�$�
C� $�
�
�h� 7� 7�
�
� "����0A� B� B�
��w�~�~�m�,�,�
3��|�|�M�2�2�2��l� �/�/�/����;�<�<�	<r$rc��|�.td�|j|j������|���s*td�||j|������	t|��td�||j|j|������#t$rYdSwxYw)Nz you must provide {an} {app} name)r'r&zX'{name}' is not a valid {app} {type}. Please make sure the {type} is a valid identifier.)rr&�typez�'{name}' conflicts with the name of an existing Python module and cannot be used as {an} {app} {type}. Please try another {type}.)rr'r&r�)r�formatrCrB�isidentifierr�ImportError)r r�name_or_dirs   r"rEzTemplateCommand.validate_name�s����<��A�H�H��<��'� I� � ���
�
� � �"�"�	��0�06����+�$�17�1�1���
�	��$�����"�"(�&���|��+�$�	#)�#�#�	�	�	
���	�	�	��D�D�	���s�0B/�/
B=�<B=c	��d�}d|jz}tj|d���}|j�|��||��\}}|jdkr|j�d|z��	t|tj
�||����\}}n*#t$r}	td|�d|�d	|	�����d
}	~	wwxYw|�d��d}
|�d
��}|r/t!j|��\}}
|
�d��p|
}n|
}|�|��d}|�d��}|s|rt'j|��}|r||z
}|
|kr7tj
�||��}t+j||��|S|S)zB
        Download the given URL and return the file name.
        c��|�d��}|�d��d}|�d��r|dz}n|}||fS)N�/���)�rstriprTrc)�url�tmpr��display_urls    r"�cleanup_urlz-TemplateCommand.download.<locals>.cleanup_url�sT���*�*�S�/�/�C��y�y��~�~�b�)�H��|�|�C� � �
"�!�C�i���!���[�(�(r$�django_%s_template_�	_download��prefix�suffixr0zDownloading %szcouldn't download URL � to �: Nr�r�zcontent-dispositionr�r;zcontent-type)rB�tempfile�mkdtemprDrr)rUrVrrFrGrHrLrrT�get�cgi�parse_header�splitext�	mimetypes�guess_extensionri�move)r r�r�r��tempdirr�r��the_path�inforu�	used_name�content_dispositionr3�params�guessed_filename�ext�content_type�guessed_paths                  r"r�zTemplateCommand.download�s��	)�	)�	)�'��)<�<���"�&��E�E�E����#�#�G�,�,�,� +��C� 0� 0���+��>�Q����K���.��<�=�=�=�	3�(��b�g�l�l�7�H�.M�.M�N�N�N�H�d�d���	3�	3�	3��,� #���X�X�X�q�q� 2�3�3�
3�����	3�����N�N�3�'�'��+�	�#�h�h�'<�=�=���	)��(�)<�=�=�I�A�v�%�z�z�*�5�5�B����(���m�m�,�-�-�a�0���x�x��/�/���	(�|�	(��+�L�9�9�C��
(� �C�'� ��(�(�(��7�<�<��1A�B�B�L��K��,�/�/�/����s�51B'�'
C�1C	�	Cc��tj|��\}}|����d��r|dd�|z}|dd�}||fS)z@
        Like os.path.splitext, but takes off .tar, too
        z.tar���N)�	posixpathr��lowerrc)r r��baser�s    r"r�zTemplateCommand.splitext*s^���&�x�0�0�	��c��:�:�<�<� � ��(�(�	��r�s�s�)�c�/�C�����9�D��S�y�r$c	�b�d|jz}tj|d���}|j�|��|jdkr|j�d|z��	tj	||��|S#tj
tf$r}td|�d|�d|�����d	}~wwxYw)
z�
        Extract the given file to a temporary directory and return
        the path of the directory with the extracted content.
        r��_extractr�r0z
Extracting %szcouldn't extract file r�r�N)
rBr�r�rDrr)rUrVrr��ArchiveExceptionrLr)r r�r�r�rus     r"r�zTemplateCommand.extract4s���
'��)<�<���"�&��D�D�D����#�#�G�,�,�,��>�Q����K���o��8�9�9�9�	7��O�H�g�.�.�.��N���(�'�2�	7�	7�	7��,� (���'�'�'�1�1� 6�7�7�
7�����	7���s�$A;�;B.�B)�)B.c�|�d|vrdS|�dd��d���}||jvS)z)Return True if the name looks like a URL.�:Fr;r)rTr��url_schemes)r r:�schemes   r"r�zTemplateCommand.is_urlEsD���h����5�����Q�'�'��*�0�0�2�2����)�)�)r$c���tj|tj��sQtj|��}tj|j��tjz}tj||��dSdS)zb
        Make sure that the file is writeable.
        Useful if our source is read-only.
        N)rF�access�W_OK�stat�S_IMODE�st_mode�S_IWUSR�chmod)r r��st�new_permissionss    r"rlzTemplateCommand.make_writeableLsc��
�y��2�7�+�+�	0����"�"�B�"�l�2�:�6�6���E�O��H�X��/�/�/�/�/�	0�	0r$r+)r)�__name__�
__module__�__qualname__�__doc__�requires_system_checksr�rdr#r�r]rEr�r�r�r�rlr4r$r"rrs�������	�	� ��*�*�*�K�!��

�
�
�$}2�}2�}2�}2�~<�<�<�4����B4�4�4�l���7�7�7�"*�*�*�0�0�0�0�0r$r)r�r�rFr�rir�r��	importlibr�urllib.requestrrX�django.confr�django.core.management.baserr�django.core.management.utilsr�django.templater	r
�django.utilsr�django.utils.versionrrr4r$r"�<module>r�s-��
�
�
�
�����	�	�	�	�����
�
�
�
���������#�#�#�#�#�#�&�&�&�&�&�&�
�
�
�
� � � � � � �A�A�A�A�A�A�A�A�:�:�:�:�:�:�+�+�+�+�+�+�+�+� � � � � � �1�1�1�1�1�1�@0�@0�@0�@0�@0�k�@0�@0�@0�@0�@0r$

Youez - 2016 - github.com/yon3zu
LinuXploit