← Back
Editing: map.cpython-311.pyc
� ��b�� � �� � d dl Z d dlZd dlZd dlmZ d dlmZ ddlm Z ddlm Z ddlmZ ddlmZ dd l mZ dd l mZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm!Z! ddlm"Z" ddl#m$Z$ ddl%m&Z& ddl%m'Z' ej( r"d dl)Z*d dl+m,Z, d dl+m-Z- dd lm.Z. dd!l%m/Z/ dd"l0m1Z1 G d#� d$� � Z2 G d%� d&� � Z3dS )'� N)�pformat)�Lock� )�_encode_idna)�_get_environ)�_to_str)�_wsgi_decoding_dance)� ImmutableDict)� MultiDict)�BadHost)� HTTPException)�MethodNotAllowed)�NotFound)� url_encode)�url_join)� url_quote)�get_host� )�DEFAULT_CONVERTERS)� BuildError)�NoMatch)�RequestAliasRedirect)�RequestPath)�RequestRedirect)�WebsocketMismatch)�StateMachineMatcher)�_simple_rule_re)�Rule)�WSGIApplication)�WSGIEnvironment)� BaseConverter)�RuleFactory)�Requestc � � e Zd ZdZ ee� � ZeZ d.de j e j d d edede d e de de j e j ee j d f de de j e j e j ge j f dede ddfd�Zdedede fd�Zede j e fd�� � Zd/de j e de j e fd�Zd0d�Z d1d ed!e j e d"e j e d#ed$ed%e j e d&e j e j e j ee j f ef dd'fd(�Z d2d)e j d* d e j e d"e j e dd'fd+�Zd3d,�Zdefd-�ZdS )4�Mapa� The map class stores all the URL rules and some configuration parameters. Some of the configuration values are only stored on the `Map` instance since those affect all rules, others are just defaults and can be overridden for each rule. Note that you have to specify all arguments besides the `rules` as keyword arguments! :param rules: sequence of url rules for this map. :param default_subdomain: The default subdomain for rules without a subdomain defined. :param charset: charset of the url. defaults to ``"utf-8"`` :param strict_slashes: If a rule ends with a slash but the matched URL does not, redirect to the URL with a trailing slash. :param merge_slashes: Merge consecutive slashes when matching or building URLs. Matches will redirect to the normalized URL. Slashes in variable parts are not merged. :param redirect_defaults: This will redirect to the default rule if it wasn't visited that way. This helps creating unique URLs. :param converters: A dict of converters that adds additional converters to the list of converters. If you redefine one converter this will override the original one. :param sort_parameters: If set to `True` the url parameters are sorted. See `url_encode` for more details. :param sort_key: The sort key function for `url_encode`. :param encoding_errors: the error method to use for decoding :param host_matching: if set to `True` it enables the host matching feature and disables the subdomain one. If enabled the `host` parameter to rules is used instead of the `subdomain` one. .. versionchanged:: 1.0 If ``url_scheme`` is ``ws`` or ``wss``, only WebSocket rules will match. .. versionchanged:: 1.0 Added ``merge_slashes``. .. versionchanged:: 0.7 Added ``encoding_errors`` and ``host_matching``. .. versionchanged:: 0.5 Added ``sort_parameters`` and ``sort_key``. N� �utf-8TF�replace�rulesr"