3
vลฯ^  ใ               @   sL  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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#ZG d$d% d%eZG d&d' d'eZG d(d) d)eZd*S )+z.
Global Django exception and warning classes.
c               @   s   e Zd ZdZdS )ฺFieldDoesNotExistz(The requested model field does not existN)ฺ__name__ฺ
__module__ฺ__qualname__ฺ__doc__ฉ r   r   ๚:/usr/lib/python3.6/site-packages/django/core/exceptions.pyr      s   r   c               @   s   e Zd ZdZdS )ฺAppRegistryNotReadyz-The django.apps registry is not populated yetN)r   r   r   r   r   r   r   r   r      s   r   c               @   s   e Zd ZdZdZdS )ฺObjectDoesNotExistz#The requested object does not existTN)r   r   r   r   Zsilent_variable_failurer   r   r   r   r	      s   r	   c               @   s   e Zd ZdZdS )ฺMultipleObjectsReturnedz?The query returned multiple objects when only one was expected.N)r   r   r   r   r   r   r   r   r
      s   r
   c               @   s   e Zd ZdZdS )ฺSuspiciousOperationz!The user did something suspiciousN)r   r   r   r   r   r   r   r   r      s   r   c               @   s   e Zd ZdZdS )ฺSuspiciousMultipartFormz+Suspect MIME request in multipart form dataN)r   r   r   r   r   r   r   r   r      s   r   c               @   s   e Zd ZdZdS )ฺSuspiciousFileOperationz/A Suspicious filesystem operation was attemptedN)r   r   r   r   r   r   r   r   r   #   s   r   c               @   s   e Zd ZdZdS )ฺDisallowedHostz'HTTP_HOST header contains invalid valueN)r   r   r   r   r   r   r   r   r   (   s   r   c               @   s   e Zd ZdZdS )ฺDisallowedRedirectz&Redirect to scheme not in allowed listN)r   r   r   r   r   r   r   r   r   -   s   r   c               @   s   e Zd ZdZdS )ฺTooManyFieldsSentzl
    The number of fields in a GET or POST request exceeded
    settings.DATA_UPLOAD_MAX_NUMBER_FIELDS.
    N)r   r   r   r   r   r   r   r   r   2   s   r   c               @   s   e Zd ZdZdS )ฺRequestDataTooBigzq
    The size of the request (excluding any file uploads) exceeded
    settings.DATA_UPLOAD_MAX_MEMORY_SIZE.
    N)r   r   r   r   r   r   r   r   r   :   s   r   c               @   s   e Zd ZdZdS )ฺRequestAbortedz=The request was closed before it was completed, or timed out.N)r   r   r   r   r   r   r   r   r   B   s   r   c               @   s   e Zd ZdZdS )ฺPermissionDeniedz+The user did not have permission to do thatN)r   r   r   r   r   r   r   r   r   G   s   r   c               @   s   e Zd ZdZdS )ฺViewDoesNotExistz!The requested view does not existN)r   r   r   r   r   r   r   r   r   L   s   r   c               @   s   e Zd ZdZdS )ฺMiddlewareNotUsedz8This middleware is not used in this server configurationN)r   r   r   r   r   r   r   r   r   Q   s   r   c               @   s   e Zd ZdZdS )ฺImproperlyConfiguredz'Django is somehow improperly configuredN)r   r   r   r   r   r   r   r   r   V   s   r   c               @   s   e Zd ZdZdS )ฺ
FieldErrorz(Some kind of problem with a model field.N)r   r   r   r   r   r   r   r   r   [   s   r   ฺ__all__c                   sZ   e Zd ZdZd fdd	Zedd Zedd Zd	d
 Zdd Z	dd Z
dd Z  ZS )ฺValidationErrorzAn error while validating data.Nc                s  t  j||| t|trTt|dr,|j}n(t|ds>|j}n|j|j|j	  }}}t|t
ri | _xด|j D ]&\}}t|tst|}|j| j|< qnW nt|tr g | _xl|D ]H}t|tsศt|}t|dr์| jjt|jj g  qฒ| jj|j qฒW n|| _|| _|| _	| g| _dS )aา  
        The `message` argument can be a single error, a list of errors, or a
        dictionary that maps field names to lists of errors. What we define as
        an "error" can be either a simple string or an instance of
        ValidationError with its message attribute set, and what we define as
        list or dictionary can be an actual `list` or `dict` or an instance
        of ValidationError with its `error_list` or `error_dict` attribute set.
        ฺ
error_dictฺmessageN)ฺsuperฺ__init__ฺ
isinstancer   ฺhasattrr   ฺ
error_listr   ฺcodeฺparamsฺdictฺitemsฺlistฺextendฺsumฺvalues)ฺselfr   r!   r"   ฺfieldฺmessages)ฺ	__class__r   r   r   e   s2    	







zValidationError.__init__c             C   s   t | d t| S )Nr   )ฺgetattrr#   )r)   r   r   r   ฺmessage_dict   s    
zValidationError.message_dictc             C   s$   t | drtt| j g S t| S )Nr   )r   r'   r#   r(   r%   )r)   r   r   r   r+      s    
zValidationError.messagesc             C   sN   t | dr6x>| jj D ]\}}|j|g j| qW n|jtg j| j |S )Nr   )r   r   r$   ฺ
setdefaultr&   ฺNON_FIELD_ERRORSr    )r)   r   r*   r    r   r   r   ฺupdate_error_dict   s
    
z!ValidationError.update_error_dictc             c   sj   t | dr6xZ| jj D ]\}}|tt|fV  qW n0x.| jD ]$}|j}|jrX||j; }t|V  q>W d S )Nr   )	r   r   r$   r%   r   r    r   r"   ฺstr)r)   r*   ฺerrorsฺerrorr   r   r   r   ฺ__iter__ฆ   s    

zValidationError.__iter__c             C   s"   t | drtt| S tt| S )Nr   )r   ฺreprr#   r%   )r)   r   r   r   ฺ__str__ฑ   s    
zValidationError.__str__c             C   s   d|  S )NzValidationError(%s)r   )r)   r   r   r   ฺ__repr__ถ   s    zValidationError.__repr__)NN)r   r   r   r   r   ฺpropertyr.   r+   r1   r5   r7   r8   ฺ__classcell__r   r   )r,   r   r   c   s   +r   c               @   s   e Zd ZdZdS )ฺEmptyResultSetz)A database query predicate is impossible.N)r   r   r   r   r   r   r   r   r;   บ   s   r;   c               @   s   e Zd ZdZdS )ฺSynchronousOnlyOperationzBThe user tried to call a sync-only function from an async context.N)r   r   r   r   r   r   r   r   r<   ฟ   s   r<   N)r   ฺ	Exceptionr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   r0   r   r;   r<   r   r   r   r   ฺ<module>   s*   W