o Ih@sdZddlZddlmZGdddeZGdddeZGdd d eZGd d d eZGd d d eZ Gddde Z Gddde Z Gddde Z Gddde Z Gddde ZGddde ZGddde ZGdddeZGdddeZGd d!d!eZGd"d#d#eZGd$d%d%eZGd&d'd'eZGd(d)d)eZd*ZGd+d,d,eZGd-d.d.eZGd/d0d0eZdS)1z. Global Django exception and warning classes. N) make_hashablec@eZdZdZdS)FieldDoesNotExistz(The requested model field does not existN__name__ __module__ __qualname____doc__r r 8/usr/lib/python3/dist-packages/django/core/exceptions.pyr rc@r)AppRegistryNotReadyz-The django.apps registry is not populated yetNrr r r r r r r c@seZdZdZdZdS)ObjectDoesNotExistz#The requested object does not existTN)rrrr silent_variable_failurer r r r rsrc@r)MultipleObjectsReturnedz?The query returned multiple objects when only one was expected.Nrr r r r rr rc@r)SuspiciousOperationz!The user did something suspiciousNrr r r r rsrc@r)SuspiciousMultipartFormz+Suspect MIME request in multipart form dataNrr r r r r!r rc@r)SuspiciousFileOperationz/A Suspicious filesystem operation was attemptedNrr r r r r&r rc@r)DisallowedHostz'HTTP_HOST header contains invalid valueNrr r r r r+r rc@r)DisallowedRedirectz&Redirect to scheme not in allowed listNrr r r r r0r rc@r)TooManyFieldsSentzl The number of fields in a GET or POST request exceeded settings.DATA_UPLOAD_MAX_NUMBER_FIELDS. Nrr r r r r5rc@r)TooManyFilesSentzk The number of fields in a GET or POST request exceeded settings.DATA_UPLOAD_MAX_NUMBER_FILES. Nrr r r r r=src@r)RequestDataTooBigzq The size of the request (excluding any file uploads) exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE. Nrr r r r rFrrc@r)RequestAbortedz=The request was closed before it was completed, or timed out.Nrr r r r rNr rc@r) BadRequestz1The request is malformed and cannot be processed.Nrr r r r rSr rc@r)PermissionDeniedz+The user did not have permission to do thatNrr r r r rXr rc@r)ViewDoesNotExistz!The requested view does not existNrr r r r r]r rc@r)MiddlewareNotUsedz8This middleware is not used in this server configurationNrr r r r rbr rc@r)ImproperlyConfiguredz'Django is somehow improperly configuredNrr r r r rgr rc@r) FieldErrorz(Some kind of problem with a model field.Nrr r r r r lr r __all__csjeZdZdZdfdd ZeddZeddZd d Zd d Z d dZ ddZ ddZ ddZ ZS)ValidationErrorzAn error while validating data.Ncst|||t|tr*t|dr|j}nt|ds|j}n |j|j|j }}}t|t rLi|_| D]\}}t|tsCt|}|j|j|<q6dSt|t r}g|_|D]$}t|tsat|}t|drs|j t|jgqV|j |jqVdS||_||_||_ |g|_dS)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_dictmessageN)super__init__ isinstancer"hasattrr# error_listr$codeparamsdictitemslistextendsumvalues)selfr$r*r+fieldmessages __class__r r r&vs6          zValidationError.__init__cCst|dt|SNr#)getattrr,r2r r r message_dicts zValidationError.message_dictcCs$t|drtt|gSt|Sr7)r(r0r,r1r.r9r r r r4s zValidationError.messagescCsLt|dr|jD] \}}||g|q |S|tg|j|Sr7)r(r#r- setdefaultr/NON_FIELD_ERRORSr))r2r#r3r)r r r update_error_dicts z!ValidationError.update_error_dictccsft|dr|jD] \}}|tt|fVq dS|jD]}|j}|jr+||j;}t|VqdSr7) r(r#r-r.r"r)r$r+str)r2r3errorserrorr$r r r __iter__s    zValidationError.__iter__cCs"t|dr tt|Stt|Sr7)r(reprr,r.r9r r r __str__s   zValidationError.__str__cCsd|S)NzValidationError(%s)r r9r r r __repr__szValidationError.__repr__cCst|tstSt|t|kS)N)r'r"NotImplementedhash)r2otherr r r __eq__s zValidationError.__eq__cCsVt|drt|j|jt|jfSt|drtt|jSttt|j t ddS)Nr$r#)key) r(rFr$r*rr+r#tuplesortedr)operator attrgetterr9r r r __hash__s  zValidationError.__hash__)NN)rrrr r&propertyr:r4r=rArCrDrHrN __classcell__r r r5r r"ts+   r"c@r)EmptyResultSetz)A database query predicate is impossible.Nrr r r r rQr rQc@r)SynchronousOnlyOperationzBThe user tried to call a sync-only function from an async context.Nrr r r r rRr rR)r rLdjango.utils.hashabler Exceptionrr rrrrrrrrrrrrrrrrr r<r"rQrRr r r r s4  g