U
    fg                     @   s   d dl mZ ddlmZ dZG dd deZG dd deZG d	d
 d
eZG dd deZG dd deZ	G dd de	Z
G dd deZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZdS )    )widgets   )Field)BooleanFieldTextAreaFieldPasswordField	FileFieldMultipleFileFieldHiddenFieldSearchFieldSubmitFieldStringFieldTelFieldURLField
EmailField
ColorFieldc                       sF   e Zd ZdZe ZdZd fdd	Zdd Z	dd	 Z
d
d Z  ZS )r   a  
    Represents an ``<input type="checkbox">``. Set the ``checked``-status by using the
    ``default``-option. Any value for ``default``, e.g. ``default="checked"`` puts
    ``checked`` into the html-element and sets the ``data`` to ``True``

    :param false_values:
        If provided, a sequence of strings each of which is an exact match
        string of what is considered a "false" value. Defaults to the tuple
        ``(False, "false", "")``
    )Ffalse Nc                    s$   t  j||f| |d k	r || _d S N)super__init__false_values)selflabelZ
validatorsr   kwargs	__class__ 9/tmp/pip-unpacked-wheel-p06mjha7/wtforms/fields/simple.pyr   $   s    zBooleanField.__init__c                 C   s   t || _d S r   )booldata)r   valuer   r   r   process_data)   s    zBooleanField.process_datac                 C   s$   |r|d | j krd| _nd| _d S )N    FT)r   r    r   Z	valuelistr   r   r   process_formdata,   s    zBooleanField.process_formdatac                 C   s   | j rt| j d S dS )Nr#   y)raw_datastrr   r   r   r   _value2   s    zBooleanField._value)NNN)__name__
__module____qualname____doc__r   ZCheckboxInputwidgetr   r   r"   r%   r*   __classcell__r   r   r   r   r      s   r   c                   @   s(   e Zd ZdZe Zdd Zdd ZdS )r   zx
    This field is the base for most of the more complicated fields, and
    represents an ``<input type="text">``.
    c                 C   s   |r|d | _ d S )Nr#   r    r$   r   r   r   r%   @   s    zStringField.process_formdatac                 C   s   | j d k	rt| j S dS )Nr   )r    r(   r)   r   r   r   r*   D   s    zStringField._valueN)	r+   r,   r-   r.   r   Z	TextInputr/   r%   r*   r   r   r   r   r   8   s   r   c                   @   s   e Zd ZdZe ZdS )r   zd
    This field represents an HTML ``<textarea>`` and can be used to take
    multi-line input.
    N)r+   r,   r-   r.   r   ZTextArear/   r   r   r   r   r   H   s   r   c                   @   s   e Zd ZdZe ZdS )r   z
    A StringField, except renders an ``<input type="password">``.

    Also, whatever value is accepted by this field is not rendered back
    to the browser like normal fields.
    N)r+   r,   r-   r.   r   ZPasswordInputr/   r   r   r   r   r   Q   s   r   c                   @   s    e Zd ZdZe Zdd ZdS )r   a-  Renders a file upload field.

    By default, the value will be the filename sent in the form data.
    WTForms **does not** deal with frameworks' file handling capabilities.
    A WTForms extension for a framework may replace the filename value
    with an object representing the uploaded data.
    c                 C   s   dS )NFr   r)   r   r   r   r*   g   s    zFileField._valueN)r+   r,   r-   r.   r   	FileInputr/   r*   r   r   r   r   r   \   s   r   c                   @   s$   e Zd ZdZejddZdd ZdS )r	   z9A :class:`FileField` that allows choosing multiple files.T)multiplec                 C   s
   || _ d S r   r1   r$   r   r   r   r%   q   s    z"MultipleFileField.process_formdataN)r+   r,   r-   r.   r   r2   r/   r%   r   r   r   r   r	   l   s   r	   c                   @   s   e Zd ZdZe ZdS )r
   z
    HiddenField is a convenience for a StringField with a HiddenInput widget.

    It will render as an ``<input type="hidden">`` but otherwise coerce to a string.
    N)r+   r,   r-   r.   r   ZHiddenInputr/   r   r   r   r   r
   u   s   r
   c                   @   s   e Zd ZdZe ZdS )r   zw
    Represents an ``<input type="submit">``.  This allows checking if a given
    submit button has been pressed.
    N)r+   r,   r-   r.   r   ZSubmitInputr/   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZe ZdS )r   z2
    Represents an ``<input type="search">``.
    N)r+   r,   r-   r.   r   ZSearchInputr/   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZe ZdS )r   z/
    Represents an ``<input type="tel">``.
    N)r+   r,   r-   r.   r   ZTelInputr/   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZe ZdS )r   z/
    Represents an ``<input type="url">``.
    N)r+   r,   r-   r.   r   ZURLInputr/   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZe ZdS )r   z1
    Represents an ``<input type="email">``.
    N)r+   r,   r-   r.   r   Z
EmailInputr/   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZe ZdS )r   z1
    Represents an ``<input type="color">``.
    N)r+   r,   r-   r.   r   Z
ColorInputr/   r   r   r   r   r      s   r   N)r   r   corer   __all__r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   <module>   s   #		
	