Ñò
‹T6Jc           @   sC   d  d k  l Z d  d k l Z h  a d e i f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   Site(   t   modelst   SiteConfigurationManagerc           B   s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   sƒ   
    A Manager that provides a get_current function for retrieving the
    SiteConfiguration for this particular running site.
    c         C   sZ   d d k  l } t i i ƒ  } | i t j o  | i i d | ƒ t | i <n t | i S(   sD   
        Returns the site configuration on the active site.
        iÿÿÿÿ(   t   SiteConfigurationt   site(   t   djblets.siteconfig.modelsR   R    t   objectst   get_currentt   idt   _SITECONFIG_CACHEt   get(   t   selfR   R   (    (    s<   /var/www/Pootle/external_apps/djblets/siteconfig/managers.pyR   &   s
     c         C   s
   h  a  d  S(   N(   R	   (   R   (    (    s<   /var/www/Pootle/external_apps/djblets/siteconfig/managers.pyt   clear_cache7   s    c         C   s?   x8 t  i ƒ  i ƒ  D]$ \ } } | i ƒ  o t  | =q q Wd S(   s%  
        Checks each cached SiteConfiguration to find out if its settings
        have expired. This should be called on each request to ensure that
        the copy of the settings is up-to-date in case another web server
        worker process modifies the settings in the database.
        N(   R	   t   copyt	   iteritemst
   is_expired(   R   t   keyt
   siteconfig(    (    s<   /var/www/Pootle/external_apps/djblets/siteconfig/managers.pyt   check_expired;   s    	 (   t   __name__t
   __module__t   __doc__R   R   R   (    (    (    s<   /var/www/Pootle/external_apps/djblets/siteconfig/managers.pyR   !   s   		N(   t   django.contrib.sites.modelsR    t	   django.dbR   R	   t   ManagerR   (    (    (    s<   /var/www/Pootle/external_apps/djblets/siteconfig/managers.pyt   <module>   s   