
pVc           @  s   d  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 d d	  Z d d d d d
  Z d d d d d  Z e
 e e j  Z d S(   uN   
Provide urlresolver functions that return fully qualified URLs or view names
i(   t   unicode_literals(   t   reverse(   t   NoReverseMatch(   t   six(   t   lazy(   t   api_settings(   t   replace_query_paramc         C  sh   | d k r |  St j g } xE | D]= } | r# | | j k r# | j | } t |  | |  }  q# q# W|  S(   u   
    Given an incoming request, and an outgoing URL representation,
    append the value of any built-in query parameters.
    N(   t   NoneR   t   URL_FORMAT_OVERRIDEt   GETR   (   t   urlt   requestt	   overridest   paramt   value(    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/reverse.pyt   preserve_builtin_query_params   s    c         K  s   t  | d d  } | d k	 rr y" | j |  | | | | |  } Wq t k
 rn t |  | | | | |  } q Xn t |  | | | | |  } t | |  S(   u   
    If versioning is being used then we pass any `reverse` calls through
    to the versioning scheme instance, so that the resulting URL
    can be modified if needed.
    u   versioning_schemeN(   t   getattrR   R   R   t   _reverseR   (   t   viewnamet   argst   kwargsR   t   formatt   extrat   schemeR
   (    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/reverse.pyR   #   s    ""c         K  sW   | d k	 r% | p i  } | | d <n  t |  d | d | | } | rS | j |  S| S(   u   
    Same as `django.core.urlresolvers.reverse`, but optionally takes a request
    and returns a fully qualified URL, using the request to get the base URL.
    u   formatR   R   N(   R   t   django_reverset   build_absolute_uri(   R   R   R   R   R   R   R
   (    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/reverse.pyR   7   s    N(   t   __doc__t
   __future__R    t   django.core.urlresolversR   R   R   t   django.utilsR   t   django.utils.functionalR   t   rest_framework.settingsR   t   rest_framework.utils.urlsR   R   R   R   t	   text_typet   reverse_lazy(    (    (    sp   /opt/seafile/seafile-server-5.1.3/seahub/thirdpart/djangorestframework-3.3.2-py2.7.egg/rest_framework/reverse.pyt   <module>   s   