ó
Ñ7ec           @  s¼  d  d l  m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l m Z d  d l	 m
 Z
 d  d l m Z m Z d  d l m Z d  d l m Z d  d l m Z d  d	 l m Z m Z d  d
 l m Z m Z m Z m Z d  d l m Z d  d l m Z d  d l  m! Z! d  d l" m# Z# e j$ d e j% ƒ Z& d e' f d „  ƒ  YZ( d e j) f d „  ƒ  YZ* d e* f d „  ƒ  YZ+ d e* f d „  ƒ  YZ, d e, f d „  ƒ  YZ- d e+ f d „  ƒ  YZ. d e. f d „  ƒ  YZ/ d e. f d „  ƒ  YZ0 d  e+ f d! „  ƒ  YZ1 d" e+ f d# „  ƒ  YZ2 d$ e+ f d% „  ƒ  YZ3 d& e+ f d' „  ƒ  YZ4 d( e+ f d) „  ƒ  YZ5 d* e+ f d+ „  ƒ  YZ6 d, e+ f d- „  ƒ  YZ7 d. e8 f d/ „  ƒ  YZ9 d0 e+ f d1 „  ƒ  YZ: d S(2   iÿÿÿÿ(   t   unicode_literalsN(   t   Header(   t   settings(   t   signalst   signing(   t   DisallowedRedirect(   t   DjangoJSONEncoder(   t   SimpleCookie(   t   sixt   timezone(   t   force_bytest	   force_strt
   force_textt
   iri_to_uri(   t   cookie_date(   t   map(   t	   responses(   t   urlparseu    ;\s*charset=(?P<charset>[^\s;]+)t   BadHeaderErrorc           B  s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR      s   t   HttpResponseBasec           B  sy  e  Z d  Z d Z d d d d d „ Z e d „  ƒ Z e j d „  ƒ Z e d „  ƒ Z	 e	 j d „  ƒ Z	 d „  Z
 e j r„ e
 Z n e
 Z e d „  ƒ Z e d	 „ Z d
 „  Z d „  Z d „  Z d „  Z e Z d „  Z d d „ Z d d d d d e e d „ Z d „  Z d d „ Z d d d „ Z d „  Z d „  Z d „  Z d „  Z  d „  Z! d „  Z" d „  Z# d „  Z$ d „  Z% RS(    uÖ   
    An HTTP response base class with dictionary-accessed headers.

    This class doesn't handle content. It should not be used directly.
    Use the HttpResponse and StreamingHttpResponse subclasses instead.
    iÈ   c         C  së   i  |  _  g  |  _ d  |  _ t ƒ  |  _ t |  _ | d  k	 r¦ y t | ƒ |  _	 Wn# t
 t f k
 rt t d ƒ ‚ n Xd |  j	 k o d k n s¦ t
 d ƒ ‚ q¦ n  | |  _ | |  _ | d  k rÝ d t j |  j f } n  | |  d <d  S(   Nu$   HTTP status code must be an integer.id   iW  u4   HTTP status code must be an integer from 100 to 599.u   %s; charset=%su   Content-Type(   t   _headerst   _closable_objectst   Nonet   _handler_classR   t   cookiest   Falset   closedt   intt   status_codet
   ValueErrort	   TypeErrort   _reason_phraset   _charsetR   t   DEFAULT_CONTENT_TYPEt   charset(   t   selft   content_typet   statust   reasonR$   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   __init__)   s$    							c         C  s)   |  j  d  k	 r |  j  St j |  j d ƒ S(   Nu   Unknown Status Code(   R!   R   R   t   getR   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   reason_phraseC   s    c         C  s   | |  _  d  S(   N(   R!   (   R%   t   value(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR+   K   s    c         C  s]   |  j  d  k	 r |  j  S|  j d d ƒ } t j | ƒ } | rV | j d ƒ j d d ƒ St j S(   Nu   Content-Typeu    u   charsetu   "(	   R"   R   R*   t   _charset_from_content_type_ret   searcht   groupt   replaceR   t   DEFAULT_CHARSET(   R%   R&   t   matched(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR$   O   s    c         C  s   | |  _  d  S(   N(   R"   (   R%   R,   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR$   Z   s    c         C  s_   d „  } g  |  j  j ƒ  D]3 \ } } d j | | d ƒ | | d ƒ g ƒ ^ q } d j | ƒ S(   u   HTTP headers as a bytestring.c         S  s    t  |  t ƒ r |  S|  j | ƒ S(   N(   t
   isinstancet   bytest   encode(   t   valt   encoding(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   to_bytes`   s    s   : u   asciiu   latin-1s   
(   R   t   valuest   join(   R%   R8   t   keyR,   t   headers(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   serialize_headers^   s    	Fc         C  s   d |  k r d |  d Sd S(   Nu   Content-Typeu   , "%s"u    (    (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   _content_type_for_reprn   s    c         C  sT  t  | t t j f ƒ s' t | ƒ } n  t  | t ƒ rN d | k sx d | k sx t  | t j ƒ r‹ d | k sx d | k r‹ t d | ƒ ‚ n  yl t j rÈ t  | t ƒ r¶ | j | ƒ qö | j | ƒ } n. t  | t ƒ rç | j | ƒ n | j | ƒ } WnV t	 k
 rO} | r6t t
 | d d t j ƒj ƒ  ƒ } qP| j d | 7_ ‚  n X| S(	   uï   Converts headers key/value to ascii/latin-1 native strings.

        `charset` must be 'ascii' or 'latin-1'. If `mime_encode` is True and
        `value` can't be represented in the given charset, MIME-encoding
        is applied.
        s   
s   u   
u   u-   Header values can't contain newlines (got %r)u   utf-8t
   maxlinelenu,   , HTTP response headers must be in %s format(   R3   R4   R   t	   text_typet   strR   t   PY3R5   t   decodet   UnicodeErrorR   t   syst   maxsizeR(   (   R%   R,   R$   t   mime_encodet   e(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   _convert_to_charsetr   s&    '*	'c         C  sG   |  j  | d ƒ } |  j  | d d t ƒ} | | f |  j | j ƒ  <d  S(   Nu   asciiu   latin-1RG   (   RI   t   TrueR   t   lower(   R%   t   headerR,   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   __setitem__–   s    c         C  s,   y |  j  | j ƒ  =Wn t k
 r' n Xd  S(   N(   R   RK   t   KeyError(   R%   RL   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   __delitem__›   s    c         C  s   |  j  | j ƒ  d S(   Ni   (   R   RK   (   R%   RL   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   __getitem__¡   s    c         C  s   | j  ƒ  |  j k S(   u$   Case-insensitive check for a header.(   RK   R   (   R%   RL   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt
   has_header¤   s    c         C  s   |  j  j ƒ  S(   N(   R   R9   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   itemsª   s    c         C  s#   |  j  j | j ƒ  d  | f ƒ d S(   Ni   (   R   R*   RK   R   (   R%   RL   t	   alternate(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR*   ­   s    u    u   /c	   
      C  s‘  t  | ƒ } | |  j | <| d k	 r¾ t | t j ƒ rª t j | ƒ r^ t j | t j ƒ } n  | | j	 ƒ  }	 |	 t j
 d d ƒ }	 d } t d |	 j d |	 j ƒ } qÏ | |  j | d <n d |  j | d <| d k	 r| |  j | d <| st t j ƒ  | ƒ |  j | d <qn  | d k	 r9| |  j | d <n  | d k	 rY| |  j | d	 <n  | rst |  j | d
 <n  | rt |  j | d <n  d S(   u5  
        Sets a cookie.

        ``expires`` can be:
        - a string in the correct format,
        - a naive ``datetime.datetime`` object in UTC,
        - an aware ``datetime.datetime`` object in any time zone.
        If it is a ``datetime.datetime`` object then ``max_age`` will be calculated.
        t   secondsi   i    i€Q u   expiresu    u   max-ageu   pathu   domainu   secureu   httponlyN(   R   R   R   R3   t   datetimeR	   t   is_awaret
   make_naivet   utct   utcnowt	   timedeltat   maxt   daysRT   R   t   timeRJ   (
   R%   R;   R,   t   max_aget   expirest   patht   domaint   securet   httponlyt   delta(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt
   set_cookie°   s2     c         C  s   | |  k r | |  | <n  d S(   u-   Sets a header unless it has already been set.N(    (   R%   R;   R,   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt
   setdefaultÜ   s    c         K  s2   t  j d | | ƒ j | ƒ } |  j | | |  S(   Nt   salt(   R   t   get_cookie_signert   signRe   (   R%   R;   R,   Rg   t   kwargs(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   set_signed_cookieá   s    c      
   C  s)   |  j  | d d d | d | d d ƒd  S(   NR^   i    R`   Ra   R_   u   Thu, 01-Jan-1970 00:00:00 GMT(   Re   (   R%   R;   R`   Ra   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   delete_cookieå   s    c         C  sQ   t  | t ƒ r t | ƒ St  | t j ƒ rA t | j |  j ƒ ƒ St | |  j ƒ S(   u=   Turn a value into a bytestring encoded in the output charset.(   R3   R4   R   R@   R5   R$   R
   (   R%   R,   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt
   make_bytesë   s
    	
c         C  sY   x3 |  j  D]( } y | j ƒ  Wq
 t k
 r1 q
 Xq
 Wt |  _ t j j d |  j ƒ d  S(   Nt   sender(	   R   t   closet	   ExceptionRJ   R   R   t   request_finishedt   sendR   (   R%   t   closable(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyRo     s    	c         C  s   t  d |  j j ƒ ‚ d  S(   Nu    This %s instance is not writable(   t   IOErrort	   __class__R   (   R%   t   content(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   write
  s    c         C  s   d  S(   N(    (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   flush  s    c         C  s   t  d |  j j ƒ ‚ d  S(   Nu)   This %s instance cannot tell its position(   Rt   Ru   R   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   tell  s    c         C  s   t  S(   N(   R   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   readable  s    c         C  s   t  S(   N(   R   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   seekable  s    c         C  s   t  S(   N(   R   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   writable  s    c         C  s   t  d |  j j ƒ ‚ d  S(   Nu    This %s instance is not writable(   Rt   Ru   R   (   R%   t   lines(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt
   writelines  s    N(&   R   R   t   __doc__R   R   R)   t   propertyR+   t   setterR$   R=   R   RB   t	   __bytes__t   __str__R>   R   RI   RM   RO   RP   RQ   t   __contains__RR   R*   Re   Rf   Rk   Rl   Rm   Ro   Rw   Rx   Ry   Rz   R{   R|   R~   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR      sD   			$					+										t   HttpResponsec           B  s¡   e  Z d  Z e Z d d „ Z d „  Z d „  Z e j	 rB e Z
 n e Z e d „  ƒ Z e j d „  ƒ Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z RS(   uw   
    An HTTP response class with a string as content.

    This content that can be read, appended to or replaced.
    t    c         O  s&   t  t |  ƒ j | | Ž  | |  _ d  S(   N(   t   superR…   R)   Rv   (   R%   Rv   t   argsRj   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR)   ,  s    c         C  s)   d i |  j  j d 6|  j d 6|  j d 6S(   Nu5   <%(cls)s status_code=%(status_code)d%(content_type)s>u   clsu   status_codeu   content_type(   Ru   R   R   R>   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   __repr__1  s    
c         C  s   |  j  ƒ  d |  j S(   u6   Full HTTP message, including headers, as a bytestring.s   

(   R=   Rv   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt	   serialize8  s    c         C  s   d j  |  j ƒ S(   NR†   (   R:   t
   _container(   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyRv   A  s    c           s   t  | d ƒ r~ t | t t j f ƒ r~ d j ‡  f d †  | Dƒ ƒ } t  | d ƒ r y | j ƒ  Wq{ t k
 rw q{ Xq n ˆ  j | ƒ } | g ˆ  _	 d  S(   Nu   __iter__R†   c         3  s   |  ] } ˆ  j  | ƒ Vq d  S(   N(   Rm   (   t   .0t   chunk(   R%   (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pys	   <genexpr>I  s    u   close(
   t   hasattrR3   R4   R   t   string_typesR:   Ro   Rp   Rm   R‹   (   R%   R,   Rv   (    (   R%   s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyRv   E  s    (
c         C  s   t  |  j ƒ S(   N(   t   iterR‹   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   __iter__T  s    c         C  s   |  j  j |  j | ƒ ƒ d  S(   N(   R‹   t   appendRm   (   R%   Rv   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyRw   W  s    c         C  s   t  |  j ƒ S(   N(   t   lenRv   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyRy   Z  s    c         C  s   |  j  S(   N(   Rv   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   getvalue]  s    c         C  s   t  S(   N(   RJ   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR|   `  s    c         C  s"   x | D] } |  j  | ƒ q Wd  S(   N(   Rw   (   R%   R}   t   line(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR~   c  s    (   R   R   R   R   t	   streamingR)   R‰   RŠ   R   RB   R‚   Rƒ   R€   Rv   R   R‘   Rw   Ry   R”   R|   R~   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR…   #  s    									t   StreamingHttpResponsec           B  sk   e  Z d  Z e Z d d „ Z e d „  ƒ Z e d „  ƒ Z e j	 d „  ƒ Z d „  Z
 d „  Z d „  Z RS(	   u$  
    A streaming HTTP response class with an iterator as content.

    This should only be iterated once, when the response is streamed to the
    client. However, it can be appended to or replaced with a new iterator
    that wraps the original content (or yields entirely new content).
    c         O  s&   t  t |  ƒ j | | Ž  | |  _ d  S(   N(   R‡   R—   R)   t   streaming_content(   R%   R˜   Rˆ   Rj   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR)   s  s    c         C  s   t  d |  j j ƒ ‚ d  S(   NuM   This %s instance has no `content` attribute. Use `streaming_content` instead.(   t   AttributeErrorRu   R   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyRv   y  s    c         C  s   t  |  j |  j ƒ S(   N(   R   Rm   t	   _iterator(   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR˜   €  s    c         C  s   |  j  | ƒ d  S(   N(   t   _set_streaming_content(   R%   R,   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR˜   „  s    c         C  s5   t  | ƒ |  _ t | d ƒ r1 |  j j | ƒ n  d  S(   Nu   close(   R   Rš   RŽ   R   R’   (   R%   R,   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR›   ˆ  s    c         C  s   |  j  S(   N(   R˜   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR‘   Ž  s    c         C  s   d j  |  j ƒ S(   NR†   (   R:   R˜   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR”   ‘  s    (    (   R   R   R   RJ   R–   R)   R€   Rv   R˜   R   R›   R‘   R”   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR—   h  s   		t   FileResponsec           B  s   e  Z d  Z d Z d „  Z RS(   u>   
    A streaming HTTP response class optimized for files.
    i   c           s   t  | d ƒ r^ | ˆ _ | ‰  t  ˆ  d ƒ r@ ˆ j j ˆ  ƒ n  t ‡  ‡ f d †  d ƒ } n	 d  ˆ _ t t ˆ ƒ j | ƒ d  S(   Nu   readu   closec             s   ˆ  j  ˆ j ƒ S(   N(   t   readt
   block_size(    (   t   filelikeR%   (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   <lambda>¡  R†   R†   (	   RŽ   t   file_to_streamR   R’   R   R   R‡   Rœ   R›   (   R%   R,   (    (   RŸ   R%   s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR›   ›  s    		(   R   R   R   Rž   R›   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyRœ   •  s   t   HttpResponseRedirectBasec           B  s8   e  Z d  d d g Z d „  Z e d „  ƒ Z d „  Z RS(   u   httpu   httpsu   ftpc         O  sp   t  t |  ƒ j | | Ž  t | ƒ |  d <t t | ƒ ƒ } | j rl | j |  j k rl t d | j ƒ ‚ n  d  S(   Nu   Locationu)   Unsafe redirect to URL with protocol '%s'(	   R‡   R¢   R)   R   R   R   t   schemet   allowed_schemesR   (   R%   t   redirect_toRˆ   Rj   t   parsed(    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR)   ª  s
    c         C  s   |  d S(   Nu   Location(    (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR    ±  R†   c         C  s3   d i |  j  j d 6|  j d 6|  j d 6|  j d 6S(   NuD   <%(cls)s status_code=%(status_code)d%(content_type)s, url="%(url)s">u   clsu   status_codeu   content_typeu   url(   Ru   R   R   R>   t   url(   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR‰   ³  s
    

(   R   R   R¤   R)   R€   R§   R‰   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR¢   §  s   	t   HttpResponseRedirectc           B  s   e  Z d  Z RS(   i.  (   R   R   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR¨   ¼  s   t   HttpResponsePermanentRedirectc           B  s   e  Z d  Z RS(   i-  (   R   R   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR©   À  s   t   HttpResponseNotModifiedc           B  s,   e  Z d  Z d „  Z e j j d „  ƒ Z RS(   i0  c         O  s$   t  t |  ƒ j | | Ž  |  d =d  S(   Nu   content-type(   R‡   Rª   R)   (   R%   Rˆ   Rj   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR)   Ç  s    c         C  s"   | r t  d ƒ ‚ n  g  |  _ d  S(   Nu7   You cannot set content to a 304 (Not Modified) response(   R™   R‹   (   R%   R,   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyRv   Ë  s    (   R   R   R   R)   R…   Rv   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyRª   Ä  s   	t   HttpResponseBadRequestc           B  s   e  Z d  Z RS(   i  (   R   R   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR«   Ò  s   t   HttpResponseNotFoundc           B  s   e  Z d  Z RS(   i”  (   R   R   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR¬   Ö  s   t   HttpResponseForbiddenc           B  s   e  Z d  Z RS(   i“  (   R   R   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR­   Ú  s   t   HttpResponseNotAllowedc           B  s    e  Z d  Z d „  Z d „  Z RS(   i•  c         O  s0   t  t |  ƒ j | | Ž  d j | ƒ |  d <d  S(   Nu   , u   Allow(   R‡   R®   R)   R:   (   R%   t   permitted_methodsRˆ   Rj   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR)   á  s    c         C  s4   d i |  j  j d 6|  j d 6|  j d 6|  d d 6S(   NuC   <%(cls)s [%(methods)s] status_code=%(status_code)d%(content_type)s>u   clsu   status_codeu   content_typeu   Allowu   methods(   Ru   R   R   R>   (   R%   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR‰   å  s
    

(   R   R   R   R)   R‰   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR®   Þ  s   	t   HttpResponseGonec           B  s   e  Z d  Z RS(   iš  (   R   R   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR°   î  s   t   HttpResponseServerErrorc           B  s   e  Z d  Z RS(   iô  (   R   R   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR±   ò  s   t   Http404c           B  s   e  Z RS(    (   R   R   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR²   ö  s   t   JsonResponsec           B  s    e  Z d  Z e e d d „ Z RS(   uI  
    An HTTP response class that consumes data to be serialized to JSON.

    :param data: Data to be dumped into json. By default only ``dict`` objects
      are allowed to be passed due to a security flaw before EcmaScript 5. See
      the ``safe`` parameter for more information.
    :param encoder: Should be an json encoder class. Defaults to
      ``django.core.serializers.json.DjangoJSONEncoder``.
    :param safe: Controls if only ``dict`` objects may be serialized. Defaults
      to ``True``.
    :param json_dumps_params: A dictionary of kwargs passed to json.dumps().
    c         K  s‚   | r% t  | t ƒ r% t d ƒ ‚ n  | d  k r: i  } n  | j d d ƒ t j | d | | } t t |  ƒ j	 d | |  d  S(   NuT   In order to allow non-dict objects to be serialized set the safe parameter to False.u   content_typeu   application/jsont   clsRv   (
   R3   t   dictR    R   Rf   t   jsont   dumpsR‡   R³   R)   (   R%   t   datat   encodert   safet   json_dumps_paramsRj   (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR)     s    	N(   R   R   R   R   RJ   R   R)   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyR³   ú  s   (;   t
   __future__R    RU   R¶   t   reRE   R]   t   email.headerR   t   django.confR   t   django.coreR   R   t   django.core.exceptionsR   t   django.core.serializers.jsonR   t   django.http.cookieR   t   django.utilsR   R	   t   django.utils.encodingR
   R   R   R   t   django.utils.httpR   t   django.utils.six.movesR   t"   django.utils.six.moves.http_clientR   t#   django.utils.six.moves.urllib.parseR   t   compilet   IR-   R   R   t   IteratorR   R…   R—   Rœ   R¢   R¨   R©   Rª   R«   R¬   R­   R®   R°   R±   Rp   R²   R³   (    (    (    s>   /usr/local/lib/python2.7/dist-packages/django/http/response.pyt   <module>   sH   "ÿ E-