
O'^c           @  s;  d  Z  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 d d
 l m Z m Z d d l m Z d d l m Z d d l m Z m Z m Z m Z d d l m Z m Z m Z m  Z  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. d   Z/ d e0 f d     YZ1 d e1 f d     YZ2 d e1 f d     YZ3 d e3 f d     YZ4 d e1 f d     YZ5 d  e1 f d!     YZ6 d" e6 f d#     YZ7 d$ e1 f d%     YZ8 d& e1 f d'     YZ9 d S((   u  
Renderers are used to serialize a response into specific media types.

They give us a generic way of being able to handle various media types
on the response, such as JSON encoded data or HTML output.

REST framework also provides an HTML renderer that renders the browsable API.
i(   t   unicode_literalsN(   t   OrderedDict(   t   forms(   t   settings(   t   ImproperlyConfigured(   t   Page(   t   parse_header(   t   Templatet   loader(   t   encode_multipart(   t   six(   t   VERSIONt
   exceptionst   serializerst   status(   t   INDENT_SEPARATORSt   LONG_SEPARATORSt   SHORT_SEPARATORSt   coreapit   template_render(   t
   ParseError(   t   is_form_media_typet   override_method(   t   api_settings(   t   encoders(   t   get_breadcrumbs(   t   ClassLookupDictc         C  s   |  d k r d  S|  S(   Ni    (   t   None(   t   value(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   zero_as_none$   s    t   BaseRendererc           B  s5   e  Z d  Z d Z d Z d Z d Z d d d  Z RS(   u   
    All renderers should extend this class, setting the `media_type`
    and `format` attributes, and override the `.render()` method.
    u   utf-8u   textc         C  s   t  d   d  S(   Nu3   Renderer class requires .render() to be implemented(   t   NotImplementedError(   t   selft   datat   accepted_media_typet   renderer_context(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   render2   s    N(	   t   __name__t
   __module__t   __doc__R   t
   media_typet   formatt   charsett   render_styleR$   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR   (   s   t   JSONRendererc           B  sT   e  Z d  Z d Z d Z e j Z e j	 Z
 e j Z d Z d   Z d d d  Z RS(   u,   
    Renderer which serializes to JSON.
    u   application/jsonu   jsonc         C  s{   | rk t  | j d   \ } } y* t t t t | d  d  d   SWqk t t t f k
 rg qk Xn  | j	 d d   S(   Nu   asciiu   indenti   i    (   R   t   encodeR   t   maxt   mint   intt   KeyErrort
   ValueErrort	   TypeErrort   getR   (   R    R"   R#   t   base_media_typet   params(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt
   get_indentF   s    *c      
   C  s   | d
 k r t   S| p i  } |  j | |  } | d
 k rU |  j rL t n t } n t } t j | d |  j	 d | d |  j
 d | } t | t j  r | j d d  j d d  } t | j d	   S| S(   uB   
        Render `data` into JSON, returning a bytestring.
        t   clst   indentt   ensure_asciit
   separatorsu    u   \u2028u    u   \u2029u   utf-8N(   R   t   bytesR7   t   compactR   R   R   t   jsont   dumpst   encoder_classR:   t
   isinstanceR
   t	   text_typet   replaceR-   (   R    R!   R"   R#   R9   R;   t   ret(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR$   U   s    	N(   R%   R&   R'   R(   R)   R   t   JSONEncoderR@   R   t   UNICODE_JSONR:   t   COMPACT_JSONR=   R   R*   R7   R$   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR,   6   s   	
		t   TemplateHTMLRendererc           B  se   e  Z d  Z d Z d Z d Z d d g Z d Z d d d  Z	 d   Z
 d   Z d	   Z d
   Z RS(   u_  
    An HTML renderer for use with templates.

    The data supplied to the Response object should be a dictionary that will
    be used as context for the template.

    The template name is determined by (in order of preference):

    1. An explicit `.template_name` attribute set on the response.
    2. An explicit `.template_name` attribute set on this class.
    3. The return result of calling `view.get_template_names()`.

    For example:
        data = {'users': User.objects.all()}
        return Response(data, template_name='users.html')

    For pre-rendered HTML, see StaticHTMLRenderer.
    u	   text/htmlu   htmlu   %(status_code)s.htmlu   api_exception.htmlu   utf-8c   
      C  s   | p	 i  } | d } | d } | d } | j  rE |  j |  } n! |  j | |  } |  j |  } t |  d  r |  j | | |  }	 n |  j | |  }	 t | |	 d | S(   uQ  
        Renders data to HTML, using Django's standard template rendering.

        The template name is determined by (in order of preference):

        1. An explicit .template_name set on the response.
        2. An explicit .template_name set on this class.
        3. The return result of calling view.get_template_names().
        u   viewu   requestu   responseu   resolve_contextt   request(   t	   exceptiont   get_exception_templatet   get_template_namest   resolve_templatet   hasattrt   resolve_contextt   get_template_contextR   (
   R    R!   R"   R#   t   viewRI   t   responset   templatet   template_namest   context(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR$      s    



	c         C  s   t  j |  S(   N(   R   t   select_template(   R    RT   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyRM      s    c         C  s'   | d } | j  r# | j | d <n  | S(   Nu   responseu   status_code(   RJ   t   status_code(   R    R!   R#   RR   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyRP      s    
	c         C  sh   | j  r | j  g S|  j  r& |  j  g St | d  r? | j   St | d  rX | j  g St d   d  S(   Nu   get_template_namesu   template_nameua   Returned a template response with no `template_name` attribute set on either the view or response(   t   template_nameRN   RL   R   (   R    RR   RQ   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyRL      s    	
	


c         C  sp   g  |  j  D] } | i | j d 6^ q
 } y |  j |  SWn. t k
 rk t d | j | j j   f  SXd  S(   Nu   status_codeu   %d %s(   t   exception_template_namesRW   RM   t	   ExceptionR   t   status_textt   title(   R    RR   t   nameRT   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyRK      s    'N(   R%   R&   R'   R(   R)   R   RX   RY   R*   R$   RM   RP   RL   RK   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyRH   x   s   				t   StaticHTMLRendererc           B  s/   e  Z d  Z d Z d Z d Z d d d  Z RS(   uV  
    An HTML renderer class that simply returns pre-rendered HTML.

    The data supplied to the Response object should be a string representing
    the pre-rendered HTML content.

    For example:
        data = '<html><body>example</body></html>'
        return Response(data)

    For template rendered HTML, see TemplateHTMLRenderer.
    u	   text/htmlu   htmlu   utf-8c         C  s   | p	 i  } | d } | r | j  r | d } |  j |  } t |  d  re |  j | | |  } n |  j | |  } t | | d | S| S(   Nu   responseu   requestu   resolve_contextRI   (   RJ   RK   RN   RO   RP   R   (   R    R!   R"   R#   RR   RI   RS   RU   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR$      s    

N(   R%   R&   R'   R(   R)   R*   R   R$   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR^      s
   t   HTMLFormRendererc           B  s  e  Z d  Z d Z d Z d Z d Z d Z e i i d d 6d d	 6e	 j
 6i d d 6d
 d	 6e	 j 6i d d 6d d	 6e	 j 6i d d 6d d	 6e	 j 6i d d 6d d	 6e	 j 6i d d 6d d	 6e	 j 6i d d 6d d	 6e	 j 6i d d 6d d	 6e	 j 6i d d 6d d	 6e	 j 6i d d 6e	 j 6i d d 6e	 j 6i d d 6e	 j 6i d d 6e	 j 6i d d 6e	 j 6i d d 6e	 j 6i d d 6e	 j 6i d d 6e	 j 6 Z d   Z d d d  Z RS(   ui  
    Renderers serializer data into an HTML form.

    If the serializer was instantiated without an object then this will
    return an HTML form not bound to any object,
    otherwise it will return an HTML form with the appropriate initial data
    populated from the object.

    Note that rendering of field and form errors is not currently supported.
    u	   text/htmlu   formu   utf-8u   rest_framework/vertical/u	   form.htmlu
   input.htmlu   base_templateu   textu
   input_typeu   emailu   urlu   numberu   datetime-localu   dateu   timeu   fileu   checkbox.htmlu   select.htmlu   select_multiple.htmlu   fieldset.htmlu   list_fieldset.htmlc         C  s$  t  | j t j  r d St |  j |  } | j | j  d | k rd | j d |  j	  | d <n  |  | d <| j
   } | j d  d k r t  | j t j  r | j j d  | _ n  d | k r | d } n | d j d  d | d	 } t j |  } i | d
 6| d 6} t | |  S(   Nu    u   template_packu   rendereru
   input_typeu   datetime-localu   Zu   templateu   /u   base_templateu   fieldu   style(   RA   t   _fieldR   t   HiddenFieldt   dictt   default_stylet   updatet   styleR4   t   template_packt   as_form_fieldR   R
   RB   t   rstript   stripR   t   get_templateR   (   R    t   fieldt   parent_styleRe   RX   RS   RU   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   render_fieldE  s     
*c   
      C  s   | p	 i  } | j  } | j d i   } d | k rC |  j | d <n  |  | d <| d j d  } | d |  j } t j |  } i | d 6| d 6}	 t | |	  S(   uN   
        Render serializer data and return an HTML form, as a string.
        u   styleu   template_packu   rendereru   /u   form(   t
   serializerR4   Rf   Ri   t   base_templateR   Rj   R   (
   R    R!   R"   R#   t   formRe   Rf   RX   RS   RU   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR$   ^  s    	

N(   R%   R&   R'   R(   R)   R*   Rf   Ro   R   R   t   Fieldt
   EmailFieldt   URLFieldt   IntegerFieldt
   FloatFieldt   DateTimeFieldt	   DateFieldt	   TimeFieldt	   FileFieldt   BooleanFieldt   ChoiceFieldt   MultipleChoiceFieldt   RelatedFieldt   ManyRelatedFieldt
   Serializert   ListSerializert   FilePathFieldRc   Rm   R   R$   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR_      sh   
	t   BrowsableAPIRendererc           B  s   e  Z d  Z d Z d Z d Z d Z d Z e Z	 d   Z
 d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d d d  Z RS(   u6   
    HTML renderer used to self-document the API.
    u	   text/htmlu   apiu   rest_framework/api.htmlu    rest_framework/filters/base.htmlu   utf-8c         C  sy   g  | j  D] } t | t  s
 | ^ q
 } g  | D] } t | d  s2 | ^ q2 } | s] d S| rn | d   S| d   S(   us   
        Return an instance of the first valid renderer.
        (Don't use another documenting renderer.)
        u   get_template_namesi    N(   t   renderer_classest
   issubclassR   RN   R   (   R    RQ   t   renderert	   rendererst   non_template_renderers(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   get_default_renderer  s    c         C  su   | s
 d Sd | d <| j  | | |  } t | d d  } | d	 k sW t d |   | d k rq d t |  S| S(
   um   
        Get the content as if it had been rendered by the default
        non-documenting renderer.
        u   [No renderers were found]i   u   indentu   render_styleu   textu   binaryu7   Expected .render_style "text" or "binary", but got "%s"u   [%d bytes of binary content](   u   textu   binary(   R$   t   getattrt   AssertionErrort   len(   R    R   R!   R"   R#   t   contentR+   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   get_content  s    

c         C  s_   | | j  k r d Sy0 | j |  | d k	 rB | j | |  n  Wn t j k
 rZ t SXt S(   uI   
        Returns True if a form should be shown for this method.
        N(   t   allowed_methodst   check_permissionsR   t   check_object_permissionsR   t   APIExceptiont   Falset   True(   R    RQ   t   methodRI   t   obj(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   show_form_for_method  s    c         O  s/   i | d 6|  j  d 6| d 6| d <| | |   S(   Nu   requestu   formatu   viewu   context(   R)   (   R    t   serializer_classt   view_instanceRI   t   argst   kwargs(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   _get_serializer  s
    
c         C  s  t  | d d  } | rX t  | d t  rX t  | d d  } t | t  r^ d } q^ n d } | j | k r | d k	 r y i | j d 6} Wn t k
 r i  } n X| } n i  } d } t | | |  K} |  j	 | | | |  s d S| d k r t
 St  | d d  }	 t  | d	 d  }
 |	 r/|
 sIt d
   | j D  rMd S| d k	 ry |  j |  SWqt k
 r}qXn  |	 r| d k r| j d | |  } q| j |   } nK | d k r|  j | j | | d | | } n |  j | j | | |  } |  j |  SWd QXd S(   u   
        Return a string representing a rendered HTML form, possibly bound to
        either the input or output data.

        In the absence of the View having an associated form then return None.
        u
   serializeru   manyu   instanceu   dataNu   DELETEu   OPTIONSu   get_serializeru   serializer_classc         s  s   |  ] } t  | j  Vq d  S(   N(   R   R(   (   t   .0t   parser(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pys	   <genexpr>  s    u   PUTu   PATCHt   instance(   u   DELETEu   OPTIONS(   u   PUTu   PATCH(   u   PUTu   PATCH(   R   R   R   RA   R   R   R!   R   R   R   R   t   anyt   parser_classest   render_form_for_serializerR3   t   get_serializerR   R   (   R    R!   RQ   R   RI   Rn   R   R   t   existing_serializert   has_serializert   has_serializer_class(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   get_rendered_html_form  sN    
	c         C  sO   t  | d  r | j   n  |  j   } | j | j |  j i i d d 6d 6 S(   Nu   initial_datau   rest_framework/horizontalu   template_packu   style(   RN   t   is_validt   form_renderer_classR$   R!   R"   (   R    Rn   t   form_renderer(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR     s    c      	     s  t  | d d  } | rX t  | d t  rX t  | d d  } t | t  r^ d } q^ n d } t | | |  D} |  j | | | |  s d S| j d } t  | d d  } t | d  r6| r6| d k r | j	 d
 |  } n | j	   } |   }	 |  j
 }
 |  j j   } d | d <|	 j | j |
 |   n d  g  | j D] } | j ^ qF} g  | D] } | | f ^ qb  | d  d t j f     f d     Y} |   SWd QXd S(   u   
        Returns a form that allows for arbitrary content types to be tunneled
        via standard HTML forms.
        (Which are typically application/x-www-form-urlencoded)
        u
   serializeru   manyu   instanceNi    u   renderer_classu   get_serializeru   PUTu   PATCHR   i   u   indentt   GenericContentFormc             sp   e  Z e j d  d d   d  d e j d i d d 6  Z e j d  d d e j d i d	 d 6 d   Z RS(
   t   labelu
   Media typet   choicest   initialt   widgett   attrsu   content-typeu   data-overrideu   Contentu   content(	   R%   R&   R   R{   t   Selectt   _content_typet	   CharFieldt   Textareat   _content(    (   R   R   R   (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR   7  s   		(   u   PUTu   PATCH(   R   R   R   RA   R   R   R   R   RN   R   R"   R#   t   copyR$   R!   R(   R   t   Form(   R    R!   RQ   R   RI   Rn   R   t   default_parsert   renderer_classR   t   acceptedRU   R   t   media_typesR(   R   (    (   R   R   R   s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   get_raw_data_form  s4    		

%c         C  s
   | j    S(   N(   t   get_view_name(   R    RQ   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   get_nameF  s    c         C  s,   | t  j t  j f k r d S| j d t  S(   Nu    t   html(   R   t   HTTP_401_UNAUTHORIZEDt   HTTP_403_FORBIDDENt   get_view_descriptionR   (   R    RQ   RW   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   get_descriptionI  s    c         C  s   t  | j |  S(   N(   R   t   path(   R    RI   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR   N  s    c         C  s>  t  | d  s  t  | d  r$ d  St | d d   } t | t  rH nZ | d  k	 r | d  k	 r y | j |  Wq t t f k
 r d  SXn t | t  s d  S| j   } g  } xQ | j	 D]F } t  | d  r |   j
 | | |  } | r| j |  qq q W| sd  St j |  j  }	 i | d 6}
 t |	 |
  S(   Nu   get_querysetu   filter_backendsu	   paginatoru   to_htmlu   elements(   RN   R   R   RA   t   listt   get_resultsR3   R1   t   get_querysett   filter_backendst   to_htmlt   appendR   Rj   t   filter_templateR   (   R    R!   RQ   RI   t	   paginatort   querysett   elementst   backendR   RS   RU   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   get_filter_formQ  s0     c         C  s  | d } | d } | d } |  j  |  } |  j | | d |  } |  j | | d |  }	 |  j | | d |  }
 |	 p~ |
 } t t | j     } d } | r d | j } | j r | d	 | j 7} q n  | | d
 <t | d d+  r| j	 j
 r| j	 } n d+ } t j } t t d d  } | j d  rC| d } n  | j d d  } i |  j | | | |  d 6| d 6| d 6| d 6| j d 6|  j | | j  d 6|  j |  d 6t d 6| d 6|  j |  d 6| j d 6g  | j D] } | j ^ qd 6| d 6|  j | | d |  d 6|  j | | d |  d 6|  j | | d |  d 6|  j | | d |  d  6|  j | | |  d! 6|	 d" 6| d# 6|
 d$ 6| d% 6t | j d& k  d' 6t d( 6| d) 6| d* 6} | S(,   u5   
        Returns the context used to render.
        u   viewu   requestu   responseu   POSTu   PUTu   PATCHu    u   %su    ;%su   Content-Typeu	   paginatoru   CSRF_HEADER_NAMEu   HTTP_X_CSRFTokenu   HTTP_i   u   _u   -u   contentu   useru   descriptionu   nameu   versionu   breadcrumblistu   allowed_methodsu   available_formatsu   response_headersu   put_formu	   post_formu   DELETEu   delete_formu   OPTIONSu   options_formu   filter_formu   raw_data_put_formu   raw_data_post_formu   raw_data_patch_formu   raw_data_put_or_patch_formi  u   display_edit_formsu   api_settingsu   csrf_cookie_nameu   csrf_header_nameN(   R   R   R   t   sortedt   itemsR(   R*   R   R   R   t   display_page_controlsR   t   CSRF_COOKIE_NAMEt
   startswithRC   R   t   userR   RW   R   R   R   R   R   R)   R   R   t   boolR   (   R    R!   R"   R#   RQ   RI   RR   R   t   raw_data_post_formt   raw_data_put_formt   raw_data_patch_formt   raw_data_put_or_patch_formt   response_headerst   renderer_content_typeR   t   csrf_cookie_namet   csrf_header_namet   renderer_clsRU   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   get_contextp  sf    


	
	

 
c         C  s   | p	 d |  _  | p i  |  _ t j |  j  } |  j | | |  } t | | d | d } | d } | j t j	 k r t j
 | _ n  | S(   uG   
        Render the HTML for the browsable API representation.
        u    RI   u   requestu   response(   R"   R#   R   Rj   RS   R   R   RW   R   t   HTTP_204_NO_CONTENTt   HTTP_200_OK(   R    R!   R"   R#   RS   RU   RD   RR   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR$     s    
N(   R%   R&   R'   R(   R)   RS   R   R*   R_   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R$   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR   t  s(   					C		>					Et   AdminRendererc           B  s,   e  Z d  Z d Z d d d  Z d   Z RS(   u   rest_framework/admin.htmlu   adminc   
      C  s  | p	 d |  _  | p i  |  _ | d } | d } |  j d } | j t j k r |  j | | | j |  |  _ i d d 6d d 6j | j d	  |  _	 t
 | | d
  " } | j | | j | j  } Wd  QX| j } n  t j |  j  } |  j | | |  } t | | d | d }	 | j t j k rZd | k rZt j | _ | j   | d <d }	 n  | j t j k rt j | _ y |  j |  d d | d <Wn t k
 r| j | d <n Xd }	 n  |	 S(   Nu    u   responseu   requestu   viewu   Createu   POSTu   Editu   PUTu   Errorsu   GETRI   u   Locationii   (   R"   R#   RW   R   t   HTTP_400_BAD_REQUESTR   R   t
   error_formR4   t   error_titleR   R   R   R!   R   Rj   RS   R   R   t   HTTP_201_CREATEDt   HTTP_303_SEE_OTHERt   build_absolute_uriR   R   R1   t	   full_path(
   R    R!   R"   R#   RR   RI   RQ   RS   RU   RD   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR$     s4    

&!		c         C  s  t  t |   j | | |  } t | d d d  } | d k	 r | d k	 r y | j |  } Wq t t f k
 r~ | } q Xn | } | d k r i  } d } n: t | t	  r | r | d n i  } d } n | } d } g  | j
   D] }	 |	 d k r |	 ^ q }
 g  | j
   D] }	 |	 d k r|	 ^ q} | | d <|
 | d <| | d	 <| | d
 <t |  d d  | d <t |  d d  | d <| S(   uG   
        Render the HTML for the browsable API representation.
        u   viewu	   paginatoru   detaili    u   listu   urlu   styleu   columnsu   detailsu   resultsu
   error_formu   error_titleN(   t   superR   R   R   R   R   R3   R1   RA   R   t   keys(   R    R!   R"   R#   RU   R   t   resultst   headerRe   t   keyt   columnst   details(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR     s4    		++



N(   R%   R&   RS   R)   R   R$   R   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR     s   (t   MultiPartRendererc           B  s/   e  Z d  Z d Z d Z d Z d d d  Z RS(   u,   multipart/form-data; boundary=BoUnDaRyStRiNgu	   multipartu   utf-8u   BoUnDaRyStRiNgc         C  s_   t  | d  rO x= | j   D], \ } } t | t  s t d |   q Wn  t |  j |  S(   Nu   itemsu   Test data contained a dictionary value for key '%s', but multipart uploads do not support nested data. You may want to consider using format='json' in this test case.(   RN   R   RA   Rb   R   R	   t   BOUNDARY(   R    R!   R"   R#   R   R   (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR$   #  s    N(   R%   R&   R(   R)   R*   R   R   R$   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR     s
   t   CoreJSONRendererc           B  s2   e  Z d  Z d Z d Z d   Z d d d  Z RS(   u   application/coreapi+jsonu   corejsonc         C  s   t  s t d   d  S(   Nu7   Using CoreJSONRenderer, but `coreapi` is not installed.(   R   R   (   R    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   __init__4  s    c         C  s:   t  | j d d   } t j j   } | j | d | S(   Nu   indenti    R9   (   R   R4   R   t   codecst   CoreJSONCodect   dump(   R    R!   R(   R#   R9   t   codec(    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR$   7  s    N(   R%   R&   R(   R   R*   R)   R   R$   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyR   /  s
   	(:   R'   t
   __future__R    R>   t   collectionsR   t   djangoR   t   django.confR   t   django.core.exceptionsR   t   django.core.paginatorR   t   django.http.multipartparserR   t   django.templateR   R   t   django.test.clientR	   t   django.utilsR
   t   rest_frameworkR   R   R   R   t   rest_framework.compatR   R   R   R   R   t   rest_framework.exceptionsR   t   rest_framework.requestR   R   t   rest_framework.settingsR   t   rest_framework.utilsR   t    rest_framework.utils.breadcrumbsR   t"   rest_framework.utils.field_mappingR   R   t   objectR   R,   RH   R^   R_   R   R   R   R   (    (    (    s:   /tmp/pip-unpacked-wheel-62FVgP/rest_framework/renderers.pyt   <module>   s<   "(	B\! WS