OwlCyberSecurity - MANAGER
Edit File: i18n.cpython-39.pyc
a kH�f�, � @ s� d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZm Z m Z d dlmZm Z d dlmZ d dlmZ d dlmZ d d lmZmZ d d lmZ d dlmZ dZd d� Zdd� ZdZG dd� de�ZG dd� de�Z dS )� N)�apps)�settings)�HttpResponse�HttpResponseRedirect�JsonResponse)�Context�Engine)� translate_url�� get_format)�url_has_allowed_host_and_scheme)�check_for_language�get_language)�DjangoTranslation)�View�languagec C s� | j �d| j�d��}|s$| �d�rdt|| �� h| �� d�sd| j�d�}t|| �� h| �� d�sdd}|rpt|�nt dd�}| j dkr�| j �t�}|r�t|�r�|r�t ||�}||kr�t|�}|jtj|tjtjtjtjtjtjd � |S ) a� Redirect to a given URL while setting the chosen language in the session (if enabled) and in a cookie. The URL and the language code need to be specified in the request parameters. Since this view changes how the user will see the rest of the site, it must only be accessed as a POST request. If called as a GET request, it will redirect to the page in the request (the 'next' parameter) without changing any state. �nextz text/html)�urlZ allowed_hostsZ require_httpsZHTTP_REFERER�/�� )�status�POST)�max_age�path�domain�secure�httponly�samesite)r �get�GETZacceptsr �get_hostZ is_secureZMETAr r �method�LANGUAGE_QUERY_PARAMETERr r � set_cookier ZLANGUAGE_COOKIE_NAMEZLANGUAGE_COOKIE_AGEZLANGUAGE_COOKIE_PATHZLANGUAGE_COOKIE_DOMAINZLANGUAGE_COOKIE_SECUREZLANGUAGE_COOKIE_HTTPONLYZLANGUAGE_COOKIE_SAMESITE)�requestZnext_url�responseZ lang_codeZ next_trans� r&