
 X                 @   s  d  Z  d d l m Z d d l m Z Gd d   d e  Z Gd d   d e  Z Gd d	   d	 e  Z	 Gd
 d   d e  Z
 Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z Gd d   d e  Z Gd  d!   d! e  Z Gd" d#   d# e  Z Gd$ d%   d% e  Z d& Z Gd' d(   d( e  Z d) S)*z.
Global Django exception and warning classes.
    )six)
force_textc               @   s   e  Z d  Z d Z d S)FieldDoesNotExistz(The requested model field does not existN)__name__
__module____qualname____doc__ r	   r	   D/home/ubuntu/projects/ifolica/build/django/django/core/exceptions.pyr      s   r   c               @   s   e  Z d  Z d S)DjangoRuntimeWarningN)r   r   r   r	   r	   r	   r
   r      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   3   s   r   c               @   s   e  Z d  Z d Z d S)TooManyFieldsSentze
    The number of fields in a POST request exceeded
    settings.DATA_UPLOAD_MAX_NUMBER_FIELDS.
    N)r   r   r   r   r	   r	   r	   r
   r   8   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)PermissionDeniedz+The user did not have permission to do thatN)r   r   r   r   r	   r	   r	   r
   r   H   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   M   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   R   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   W   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                   s   e  Z d  Z d Z d 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   S)ValidationErrorzAn error while validating data.Nc                s  t  t |   j | | |  t | t  r t | d  rF | j } q t | t j r[ d n d  sp | j } q | j	 | j
 | j } } } n  t | t  r i  |  _ x| j   D]: \ } } t | t  s t |  } n  | j |  j | <q Wn t | t  rg  |  _ x | D]k } t | t  s9t |  } n  t | d  rm|  j j t | j j   g    q|  j j | j  qWn' | |  _	 | |  _
 | |  _ |  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messagecodeN)superr   __init__
isinstancehasattrr   r   PY3
error_listr   r   paramsdictitemslistextendsumvalues)selfr   r   r&   fieldmessages)	__class__r	   r
   r!   f   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   s2   t  |  d  r( t t |   j   g   St |   S)Nr   )r#   r+   r'   r,   r)   )r-   r	   r	   r
   r/      s    zValidationError.messagesc             C   sk   t  |  d  rK xU |  j j   D]% \ } } | j | g   j |  q Wn | 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   s   t  |  d  rI xx |  j j   D]# \ } } | t t |   f Vq WnA x> |  j D]3 } | j } | j r{ | | j ;} n  t |  VqS Wd  S)Nr   )	r#   r   r(   r)   r   r%   r   r&   r   )r-   r.   errorserrorr   r	   r	   r
   __iter__   s    		zValidationError.__iter__c             C   s/   t  |  d  r t t |    St 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__)r   r   r   r   r!   propertyr2   r/   r5   r8   r:   r;   r	   r	   )r0   r
   r   d   s   0r   N)r   Zdjango.utilsr   Zdjango.utils.encodingr   	Exceptionr   RuntimeWarningr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r4   r   r	   r	   r	   r
   <module>   s*   