
    h                     n    S SK Jr  S SKJr  S SKJr  S SKJr  S SKJ	r	  S SK
Jr  S SKJr   " S S	\5      rg
)    )FileSystemFinder)settings)Error)OrderedDict)
connection)utils)TenantFileSystemStoragec                      ^  \ rS rSrSrS
S jr\S 5       r\R                  S 5       r\S 5       r	\	R                  S 5       r	U 4S jr
S	rU =r$ )TenantFileSystemFinder   ak  
A static files finder that uses the ``MULTITENANT_STATICFILES_DIRS`` setting
to locate files for different tenants.

The only difference between this and the standard FileSystemFinder implementation
is that we need to keep references to the storage locations of the static files,
as well as maps of dir paths to an appropriate storage instance, for each tenant.
c                      0 U l         0 U l        g N
_locations	_storages)self	app_namesargskwargss       T/var/www/html/env/lib/python3.13/site-packages/django_tenants/staticfiles/finders.py__init__TenantFileSystemFinder.__init__   s         c                    U R                   R                  [        R                  S5      c  / n[        R
                   HV  n[        R                  " U5      n[        U[        [        45      (       a  Uu  p2OSnX24U;  d  MD  UR                  X245        MX     XR                   [        R                  '   U R                   [        R                     $ )z
Lazy retrieval of list of locations with static files based on current tenant schema.
:return: The list of static file dirs that have been configured for this tenant.
N )r   getr   schema_namer   MULTITENANT_STATICFILES_DIRStenant_utilsparse_tenant_config_path
isinstancelisttupleappend)r   schema_locationsrootprefixs       r   	locations TenantFileSystemFinder.locations   s     ??z55t<D! ==#<<TBdT5M22#'LFDF>)99$++VN; > 7GOOJ223z5566r   c                 <    XR                   [        R                  '   g r   )r   r   r   r   values     r   r(   r)   5   s    27
../r   c                 .   U R                   R                  [        R                  S5      cN  [	        5       nU R
                   H  u  p#[        US9nX$l        XAU'   M     XR                   [        R                  '   U R                   [        R                     $ )z
Lazy retrieval of list of storage handlers for the current tenant.
:return: A ,a[ pf dir paths to an appropriate storage instance.
N)location)r   r   r   r   r   r(   r	   r'   )r   schema_storagesr'   r&   filesystem_storages        r   storagesTenantFileSystemFinder.storages9   s{     >>j44d;C)mO $%<d%K",2)(:% !/
 6ENN:112~~j4455r   c                 <    XR                   [        R                  '   g r   )r   r   r   r+   s     r   r1   r2   K   s    16z--.r   c                    > [         TU ]  " S0 UD6n[        R                  n[	        U[
        [        45      (       d  UR                  [        SSS95        U$ )zj
In addition to parent class' checks, also ensure that MULTITENANT_STATICFILES_DIRS
is a tuple or a list.
zAYour MULTITENANT_STATICFILES_DIRS setting is not a tuple or list.z$Perhaps you forgot a trailing comma?)hint )	supercheckr   r   r!   r"   r#   r$   r   )r   r   errorsmultitenant_staticfiles_dirs	__class__s       r   r8   TenantFileSystemFinder.checkO   sU    
 (('/'L'L$6uFFMMW? r   r   r   )__name__
__module____qualname____firstlineno____doc__r   propertyr(   setterr1   r8   __static_attributes____classcell__)r;   s   @r   r   r      sq     7 7, 8 8 6 6" __7 7 r   r   N)"django.contrib.staticfiles.findersr   django.confr   django.core.checksr   collectionsr   	django.dbr   django_tenantsr   r   django_tenants.files.storager	   r   r6   r   r   <module>rM      s)    ?   $ #   0 @S- Sr   