
    wdf                     :    d dl mZ d dlmZ  G d de          ZdS )    )WebobInputWrapper)i18nc                   V    e Zd ZdZd Zd Zd ZdZdZdZ	dZ
dZd ZdZd	Zi Zd
 Zd ZdS )DefaultMetaz
    This is the default Meta class which defines all the default values and
    therefore also the 'API' of the class Meta interface.
    c                       |j         dd|i|S )a  
        bind_field allows potential customization of how fields are bound.

        The default implementation simply passes the options to
        :meth:`UnboundField.bind`.

        :param form: The form.
        :param unbound_field: The unbound field.
        :param options:
            A dictionary of options which are typically passed to the field.

        :return: A bound field
        form )bind)selfr   unbound_fieldoptionss       Q/var/www/book.euthymeo.com/html/venv/lib/python3.11/site-packages/wtforms/meta.py
bind_fieldzDefaultMeta.bind_field   s"     "}!77t7w777    c                     |>t          |d          s.t          |d          rt          |          S t          d          |S )aZ  
        wrap_formdata allows doing custom wrappers of WTForms formdata.

        The default implementation detects webob-style multidicts and wraps
        them, otherwise passes formdata back un-changed.

        :param form: The form.
        :param formdata: Form data.
        :return: A form-input wrapper compatible with WTForms.
        NgetlistgetallzNformdata should be a multidict-type wrapper that supports the 'getlist' method)hasattrr   	TypeError)r   r   formdatas      r   wrap_formdatazDefaultMeta.wrap_formdata   sN     )(D(Dx** r(222 pqqqr   c                 ^    t          |dd          }|t          |fi |} |j        |fi |S )z
        render_field allows customization of how widget rendering is done.

        The default implementation calls ``field.widget(field, **render_kw)``
        	render_kwN)getattrdictwidget)r   fieldr   other_kws       r   render_fieldzDefaultMeta.render_field/   sJ     5+t44X3333Iu|E//Y///r   F
csrf_tokenNc                 X    | j         |                                  S ddlm}  |            S )a  
        Build a CSRF implementation. This is called once per form instance.

        The default implementation builds the class referenced to by
        :attr:`csrf_class` with zero arguments. If `csrf_class` is ``None``,
        will instead use the default implementation
        :class:`wtforms.csrf.session.SessionCSRF`.

        :param form: The form.
        :return: A CSRF implementation.
        Nr   )SessionCSRF)
csrf_classwtforms.csrf.sessionr"   )r   r   r"   s      r   
build_csrfzDefaultMeta.build_csrfB   s:     ?&??$$$444444{}}r   Tc                     | j         }|du rdS | j        rO|rt          |          nd}| j                            |          }|t          j        |          x}| j        |<   |S t          j        |          S )z
        Override in subclasses to provide alternate translations factory.
        See the i18n documentation for more.

        :param form: The form.
        :return: An object that provides gettext() and ngettext() methods.
        FN)localescache_translationstupletranslations_cachegetr   get_translations)r   r   r'   translationss       r   r,   zDefaultMeta.get_translationsZ   s     ,e4" 	 (/9eGnnnTG266w??L#BFBWX_B`B``t6w?$W---r   c                 \    |                                 D ]\  }}t          | ||           dS )zV
        Given a dictionary of values, update values on this `Meta` instance.
        N)itemssetattr)r   valueskeyvalues       r   update_valueszDefaultMeta.update_valuest   s>     !,,.. 	& 	&JCD#u%%%%	& 	&r   )__name__
__module____qualname____doc__r   r   r   csrfcsrf_field_namecsrf_secretcsrf_contextr#   r%   r'   r(   r*   r,   r4   r	   r   r   r   r      s         8 8 8   $	0 	0 	0 D"OKLJ  ( G. . .4& & & & &r   r   N)wtforms.utilsr   wtformsr   objectr   r	   r   r   <module>r@      sg    + + + + + +      t& t& t& t& t&& t& t& t& t& t&r   