ó
P'—^c           @@  sè   d  d l  m Z d  d l Z d  d l m Z d  d l m Z d  d l m Z d  d l	 m
 Z
 d  d l m Z d  d l m Z y d  d	 l m Z Wn! e k
 r³ d  d	 l m Z n Xe e j d
 ƒ ƒ Z e j d „  ƒ Z d „  Z d S(   i    (   t   absolute_importN(   t   Integral(   t   settings(   t   checks(   t   six(   t   urlparse(   t   conf(   t   Sequencet    c         K@  s-  g  } t  t j t j ƒ s: | j t j d d d ƒƒ n  t  t j t j ƒ sn | j t j d d d ƒƒ n  t	 t j
 t ƒ sŸ | j t j d d d ƒƒ n  t	 t j t ƒ sÁ t j d k  rà | j t j d	 d d
 ƒƒ n  t	 t j t ƒ s| j t j d d d ƒƒ n  t  t j t j ƒ sE| j t j d d d ƒƒ nÛ xØ t j D]Í } | d k rgqOn  t | ƒ } | j d k s‘| j d k rÅ| j t j d j t | ƒ ƒ d d d d ƒƒ qOxT d& D]L } t | | ƒ d k rÌ| j t j d j t | ƒ | ƒ d d ƒƒ qÌqÌWqOWt  t j t j t f ƒ s[| j t j d d d ƒƒ n  t  t j t j ƒ s| j t j d d d ƒƒ n  t	 t j t j t f ƒ sÊ| j t j d d d  ƒƒ n  t	 t j t ƒ sû| j t j d! d d" ƒƒ n  t t d# ƒ r)| j t j d$ d d% ƒƒ n  | S('   Ns3   CORS_ALLOW_HEADERS should be a sequence of strings.t   ids   corsheaders.E001s3   CORS_ALLOW_METHODS should be a sequence of strings.s   corsheaders.E002s(   CORS_ALLOW_CREDENTIALS should be a bool.s   corsheaders.E003i    sJ   CORS_PREFLIGHT_MAX_AGE should be an integer greater than or equal to zero.s   corsheaders.E004s'   CORS_ORIGIN_ALLOW_ALL should be a bool.s   corsheaders.E005s6   CORS_ORIGIN_WHITELIST should be a sequence of strings.s   corsheaders.E006t   nullR   s>   Origin {} in CORS_ORIGIN_WHITELIST is missing scheme or netlocs   corsheaders.E013t   hints:   Add a scheme (e.g. https://) or netloc (e.g. example.com).t   patht   paramst   queryt   fragments5   Origin {} in CORS_ORIGIN_WHITELIST should not have {}s   corsheaders.E014sT   CORS_ORIGIN_REGEX_WHITELIST should be a sequence of strings and/or compiled regexes.s   corsheaders.E007s)   CORS_EXPOSE_HEADERS should be a sequence.s   corsheaders.E008s,   CORS_URLS_REGEX should be a string or regex.s   corsheaders.E009s,   CORS_REPLACE_HTTPS_REFERER should be a bool.s   corsheaders.E011t
   CORS_MODELsK   The CORS_MODEL setting has been removed - see django-cors-headers' HISTORY.s   corsheaders.E012(   R   R   R   R   (   t   is_sequenceR   t   CORS_ALLOW_HEADERSR   t   string_typest   appendR   t   Errort   CORS_ALLOW_METHODSt
   isinstancet   CORS_ALLOW_CREDENTIALSt   boolt   CORS_PREFLIGHT_MAX_AGER   t   CORS_ORIGIN_ALLOW_ALLt   CORS_ORIGIN_WHITELISTR   t   schemet   netloct   formatt   reprt   getattrt   CORS_ORIGIN_REGEX_WHITELISTt   re_typet   CORS_EXPOSE_HEADERSt   CORS_URLS_REGEXt   CORS_REPLACE_HTTPS_REFERERt   hasattrR   (   t   app_configst   kwargst   errorst   origint   parsedt   part(    (    s4   /tmp/pip-unpacked-wheel-smm0Wk/corsheaders/checks.pyt   check_settings   sŽ    "c         @  s)   t  |  t ƒ o( t ‡  f d †  |  Dƒ ƒ S(   Nc         3@  s   |  ] } t  | ˆ  ƒ Vq d  S(   N(   R   (   t   .0t   x(   t   types(    s4   /tmp/pip-unpacked-wheel-smm0Wk/corsheaders/checks.pys	   <genexpr>Š   s    (   R   R   t   all(   t   thingR1   (    (   R1   s4   /tmp/pip-unpacked-wheel-smm0Wk/corsheaders/checks.pyR   ‡   s    (   t
   __future__R    t   ret   numbersR   t   django.confR   t   django.coreR   t   django.utilsR   t#   django.utils.six.moves.urllib.parseR   t   corsheaders.confR   t   collections.abcR   t   ImportErrort   collectionst   typet   compileR#   t   registerR.   R   (    (    (    s4   /tmp/pip-unpacked-wheel-smm0Wk/corsheaders/checks.pyt   <module>   s   r