ó
P'—^c           @   sW   d  Z  d d l m Z d d l Z d d l m Z m Z d „  Z d „  Z d „  Z	 d S(	   s¨   
Functions responsible for returning filenames for the given image generator.
Users are free to define their own functions; these are just some some sensible
choices.

iÿÿÿÿ(   t   settingsNi   (   t   format_to_extensiont   suggest_extensionc         C   s®   t  |  j d d ƒ } | d k s3 t j j | ƒ r? t j } n( t j j t j t j j	 | ƒ d ƒ } t
 | ps d |  j ƒ } t j j t j j | d |  j ƒ  | f ƒ ƒ S(   s\  
    A namer that, given the following source file name::

        photos/thumbnails/bulldog.jpg

    will generate a name like this::

        /path/to/generated/images/photos/thumbnails/bulldog/5ff3233527c5ac3e4b596343b440ff67.jpg

    where "/path/to/generated/images/" is the value specified by the
    ``IMAGEKIT_CACHEFILE_DIR`` setting.

    t   namei    t    s   %s%sN(   t   getattrt   sourcet   Nonet   ost   patht   isabsR    t   IMAGEKIT_CACHEFILE_DIRt   joint   splitextR   t   formatt   normpatht   get_hash(   t	   generatort   source_filenamet   dirt   ext(    (    s<   /tmp/pip-unpacked-wheel-XxTEJK/imagekit/cachefiles/namers.pyt   source_name_as_path   s    c         C   sÓ   t  |  j d d ƒ } | d k s3 t j j | ƒ r? t j } n$ t j j t j t j j	 | ƒ ƒ } t
 | po d |  j ƒ } t j j | ƒ } t j j t j j | d t j j | ƒ d |  j ƒ  d  | f ƒ ƒ S(   sH  
    A namer that, given the following source file name::

        photos/thumbnails/bulldog.jpg

    will generate a name like this::

        /path/to/generated/images/photos/thumbnails/bulldog.5ff3233527c5.jpg

    where "/path/to/generated/images/" is the value specified by the
    ``IMAGEKIT_CACHEFILE_DIR`` setting.

    R   R   s   %s.%s%si    i   N(   R   R   R   R   R	   R
   R    R   R   t   dirnameR   R   t   basenameR   R   R   (   R   R   R   R   R   (    (    s<   /tmp/pip-unpacked-wheel-XxTEJK/imagekit/cachefiles/namers.pyt   source_name_dot_hash+   s    c         C   s\   t  |  d d ƒ } | r$ t | ƒ n d } t j j t j j t j d |  j	 ƒ  | f ƒ ƒ S(   sB  
    A namer that, given the following source file name::

        photos/thumbnails/bulldog.jpg

    will generate a name like this::

        /path/to/generated/images/5ff3233527c5ac3e4b596343b440ff67.jpg

    where "/path/to/generated/images/" is the value specified by the
    ``IMAGEKIT_CACHEFILE_DIR`` setting.

    R   R   s   %s%sN(
   R   R   R   R   R	   R   R   R    R   R   (   R   R   R   (    (    s<   /tmp/pip-unpacked-wheel-XxTEJK/imagekit/cachefiles/namers.pyt   hashJ   s    (
   t   __doc__t   django.confR    R   t   utilsR   R   R   R   R   (    (    (    s<   /tmp/pip-unpacked-wheel-XxTEJK/imagekit/cachefiles/namers.pyt   <module>   s   		