
pVc           @  s  d  Z  d d l m Z d d l 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 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 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 e- f d     YZ. d e. f d     YZ/ d e. f d     YZ0 d e0 f d     YZ1 d e. f d     YZ2 d e. f d      YZ3 d! e3 f d"     YZ4 d# e. f d$     YZ5 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   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   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(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/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(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   render2   s    N(	   t   __name__t
   __module__t   __doc__R   t
   media_typet   formatt   charsett   render_styleR"   (    (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/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(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt
   get_indentG   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   bytesR5   t   compactR   R   R   t   jsont   dumpst   encoder_classR8   t
   isinstanceR	   t	   text_typet   replaceR+   (   R   R   R    R!   R7   R9   t   ret(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR"   V   s    	N(   R#   R$   R%   R&   R'   R   t   JSONEncoderR>   R   t   UNICODE_JSONR8   t   COMPACT_JSONR;   R   R(   R5   R"   (    (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/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 |  } |  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   responset   request(   t	   exceptiont   get_exception_templatet   get_template_namest   resolve_templatet   resolve_contextR   (
   R   R   R    R!   t   viewRG   t   responset   templatet   template_namest   context(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR"      s    



	c         C  s   t  j |  S(   N(   R   t   select_template(   R   RP   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyRK      s    c         C  s   | j  r | j | d <n  | S(   Nu   status_code(   RH   t   status_code(   R   R   RG   RN   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyRL      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_namet   hasattrRJ   R   (   R   RN   RM   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyRJ      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_namesRS   RK   t	   ExceptionR   t   status_textt   title(   R   RN   t   nameRP   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyRI      s    'N(   R#   R$   R%   R&   R'   R   RT   RV   R(   R"   RK   RL   RJ   RI   (    (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyRF   y   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  sj   | p	 i  } | d } | rf | j  rf | d } |  j |  } |  j | | |  } t | | d | S| S(   Nu   responseu   requestRG   (   RH   RI   RL   R   (   R   R   R    R!   RN   RG   RO   RQ   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR"      s    

N(   R#   R$   R%   R&   R'   R(   R   R"   (    (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/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 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(   R?   t   _fieldR   t   HiddenFieldt   dictt   default_stylet   updatet   styleR2   t   template_packt   as_form_fieldR   R	   R@   t   rstript   stripR   t   get_templateR   (   R   t   fieldt   parent_styleRb   RT   RO   RQ   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   render_field;  s     
*c   
      C  s   | j  } | j d i   } d | k r7 |  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
   serializerR2   Rc   Rf   t   base_templateR   Rg   R   (
   R   R   R    R!   t   formRb   Rc   RT   RO   RQ   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR"   T  s    	

N(   R#   R$   R%   R&   R'   R(   Rc   Rl   R   R   t   Fieldt
   EmailFieldt   URLFieldt   IntegerFieldt   DateTimeFieldt	   DateFieldt	   TimeFieldt	   FileFieldt   BooleanFieldt   ChoiceFieldt   MultipleChoiceFieldt   RelatedFieldt   ManyRelatedFieldt
   Serializert   ListSerializert   FilePathFieldR`   Rj   R   R"   (    (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR\      sb   
	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 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~   RU   R   (   R   RM   t   renderert	   rendererst   non_template_renderers(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   get_default_renderert  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)   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/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   RM   t   methodRG   t   obj(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/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_instanceRG   t   argst   kwargs(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   _get_serializer  s
    
c         C  sB  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 | | |  n} |  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	 rb| } n |	 r| d k r| j d | |  } q| j |   } nK | d k r|  j | j | | d | | } n |  j | j | | |  } t | d  r| j   n  |  j   } | j | j |  j i i d d 6d 6 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(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pys	   <genexpr>  s    u   PUTu   PATCHt   instanceu   initial_datau   rest_framework/horizontalu   template_packu   style(   u   DELETEu   OPTIONS(   u   PUTu   PATCH(   u   PUTu   PATCH(   R   R   R   R?   R   R   R   R   R   R   R   t   anyt   parser_classest   get_serializerR   R   RU   t   is_validt   form_renderer_classR"   R    (   R   R   RM   R   RG   Rk   R   R   t   existing_serializert   has_serializert   has_serializer_classt   form_renderer(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   get_rendered_html_form  sT    
		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   Rw   t   Selectt   _content_typet	   CharFieldt   Textareat   _content(    (   R   R   R   (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR   &  s   		(   u   PUTu   PATCH(   R   R   R   R?   R   R   R   R   RU   R   R    R!   t   copyR"   R   R&   R   t   Form(   R   R   RM   R   RG   Rk   R   t   default_parsert   renderer_classR   t   acceptedRQ   R   t   media_typesR&   R   (    (   R   R   R   sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   get_raw_data_form  s4    		

%c         C  s
   | j    S(   N(   t   get_view_name(   R   RM   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   get_name5  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   RM   RS   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   get_description8  s    c         C  s   t  | j |  S(   N(   R   t   path(   R   RG   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR   =  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(   RU   R   R   R?   t   listt   get_resultsR1   R/   t   get_querysett   filter_backendst   to_htmlt   appendR   Rg   t   filter_templateR   (   R   R   RM   RG   t	   paginatort   querysett   elementst   backendR   RO   RQ   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   get_filter_form@  s0     c         C  sl  | 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" } i |  j | | | |  d 6| d 6| d 6| 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} | S(#   u5   
        Returns the context used to render.
        u   viewu   requestu   responseu   POSTu   PUTu   PATCHu    u   %su    ;%su   Content-Typeu	   paginatoru   contentu   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_settingsN(   R   R   R   t   sortedt   itemsR&   R(   R   R   R   t   display_page_controlsR   R   RS   R   R
   R   R   R   R'   R   R   t   boolR   (   R   R   R    R!   RM   RG   RN   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   renderer_clsRQ   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   get_context_  sV    


	

 
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    RG   u   requestu   response(   R    R!   R   Rg   RO   R   R   RS   R   t   HTTP_204_NO_CONTENTt   HTTP_200_OK(   R   R   R    R!   RO   RQ   RB   RN   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR"     s    
N(   R#   R$   R%   R&   R'   RO   R   R(   R\   R   R   R   R   R   R   R   R   R   R   R   R   R   R"   (    (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR~   i  s&   					H	>					<t   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   GETRG   u   Locationii   (   R    R!   RS   R   t   HTTP_400_BAD_REQUESTR   R   t
   error_formR2   t   error_titleR   R   R   R   R   Rg   RO   R   R   t   HTTP_201_CREATEDt   HTTP_302_FOUNDt   build_absolute_uriR   R   R/   t	   full_path(
   R   R   R    R!   RN   RG   RM   RO   RQ   RB   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/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   R1   R/   R?   R   t   keys(   R   R   R    R!   RQ   R   t   resultst   headerRb   t   keyt   columnst   details(    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR     s4    		++



N(   R#   R$   RO   R'   R   R"   R   (    (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR     s   (t   MultiPartRendererc           B  sD   e  Z d  Z d Z d Z e j d k r- d n d Z d	 d	 d  Z	 RS(
   u,   multipart/form-data; boundary=BoUnDaRyStRiNgu	   multipartu   utf-8i   i   u   BoUnDaRyStRiNgt   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.(   RU   R   R?   R_   R   R   t   BOUNDARY(   R   R   R    R!   R   R   (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR"   	  s    (   i   i   N(
   R#   R$   R&   R'   R(   t   djangoR
   R   R   R"   (    (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyR     s
   (6   R%   t
   __future__R    R<   t   collectionsR   R   R   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   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*   RF   R[   R\   R~   R   R   (    (    (    sr   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/renderers.pyt   <module>   s:   ""	CXz HS