File: //home/arjun/projects/env/lib64/python3.10/site-packages/wtforms/__pycache__/meta.cpython-310.pyc
o
"we � @ s6 d dl mZ d dlmZ d dlmZ G dd� d�ZdS )� )�i18n)�WebobInputWrapper�� clean_keyc @ s` e Zd ZdZdd� Zdd� Zdd� ZdZd Zd
Z d
Z
d
Zdd� ZdZ
d
Zi Zdd� Zdd� Zd
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 C s |j dd|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
�formN� )�bind)�selfr �
unbound_field�optionsr r �E/home/arjun/projects/env/lib/python3.10/site-packages/wtforms/meta.py�
bind_field s zDefaultMeta.bind_fieldc C s0 |durt |d�st |d�rt|�S td��|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 �formdatar r r
�
wrap_formdata s
�zDefaultMeta.wrap_formdatac C sZ dd� |� � D �}t|dd�}|dur$dd� |� � D �}t|fi |��}|j|fi |��S )z�
render_field allows customization of how widget rendering is done.
The default implementation calls ``field.widget(field, **render_kw)``
c S � i | ] \}}t |�|�qS r r ��.0�k�vr r r
�
<dictcomp>: � z,DefaultMeta.render_field.<locals>.<dictcomp>� render_kwNc S r r r r r r r
r >