
    OgN#                        d Z ddl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	 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lmZ daed$d       Zd Zd$dZeedfdZeeddfdZeedfdZeeddfdZd$dZd$dZ d Z!ed%d       Z"ddl#Z$e$jJ                  jJ                  jL                  jO                  e"       d%dZ(d&dZ)d$dZ*d$dZ+ e,       Z-d%dZ.d'd Z/d! Z0d$d"Z1d$d#Z2y# e$ r	 ddlmZ Y w xY w)(zZope 3 Component Architecture
    N)	Interface)implementedBy)
providedBy)IComponentArchitecture)!IComponentRegistrationConvenience)IFactory)ComponentLookupError)IComponentLookup)_BLANK)	adaptedBy)adapter)adapts)hookablec                     | t         ddlm a  t         S 	 t        |       S # t        $ r}t	        |j
                   d}~ww xY w)z! See IComponentArchitecture.
    Nr   )base)r   zope.component.globalregistryr
   	TypeErrorr	   args)contexterrors     N/var/www/djangounited/venv/lib/python3.12/site-packages/zope/component/_api.pygetSiteManagerr   ,   sE    
 <:	4#G,, 	4&

33	4s   
! 	A<Ac                 <    t        | ||      }|t        | |      |S N)queryAdapterInContextr	   )object	interfacer   r   s       r   getAdapterInContextr   ?   s'    #FIw?G"6955N    c                     t        | dd       }|	  ||      }||S |j                  |       r| S t        |      j                  | |d|      S # t        $ r% t        j                         d   j                   Y ]w xY w)N__conform__    )getattrr   sysexc_infotb_nextr   r   queryAdapter)r   r   r   defaultconformr   s         r   r   r   E   s    fmT2G	i(G "F#'"//	2wOO)  	 ||~a ((4  5	s   A +A;:A;c                 B    t        | ||d |      }|t        | ||      |S r   )r(   r	   )r   r   namer   r   s        r   
getAdapterr-   `   s-    69dD'BG"69d;;Nr   c                 \    |t        || ||      S t        |      j                  | |||      S r   )adapter_hookr   r(   )r   r   r,   r)   r   s        r   r(   r(   f   s9    IvtW=='"//	4079 9r   c                 B    t        | |||      }|t        | ||      |S N)r   )queryMultiAdapterr	   )objectsr   r,   r   r   s        r   getMultiAdapterr4   m   s+    D'JG"7It<<Nr   c                 d    	 t        |      }|j                  | |||      S # t        $ r |cY S w xY wr   )r   r	   r2   )r3   r   r,   r)   r   sitemanagers         r   r2   r2   s   s@    $W-
 (()T7KK	   s   ! //c                 `    	 t        |      }|j                  | |      S # t        $ r g cY S w xY wr   )r   r	   getAdapters)r3   providedr   r6   s       r   r8   r8   }   s<    $W- ""7H55   	    --c                 `    	 t        |      }|j                  | |      S # t        $ r g cY S w xY wr   )r   r	   subscribers)r3   r   r   r6   s       r   r<   r<      s<    $W- ""7I66   	r:   c                  :    t        d       j                  | d        y r   )r   r<   )r3   s    r   handler>      s    4$$Wd3r   c                 ^    	 t               }|j                  || ||      S # t        $ r Y y w xY wr   )r   r	   r(   )r   r   r,   r)   r6   s        r   r/   r/      s<    $& ##FItWEE   s   
  	,,c                 >    t        | ||      }||S t        | |      r1   )queryUtilityr	   )r   r,   r   utilitys       r   
getUtilityrC      s(    9dG<G
y$
//r   c                 :    t        |      j                  | ||      S r   )r   rA   )r   r,   r)   r   s       r   rA   rA      s    '"//	4IIr   c                 6    t        |      j                  |       S r   )r   getUtilitiesForr   r   s     r   rF   rF      s    '"229==r   c                 6    t        |      j                  |       S r   )r   getAllUtilitiesRegisteredForrG   s     r   rI   rI      s    '"??	JJr   c                     	 t        |       }|j                  }|D ]%  }|j                  ||t              }|t        us#|c S  |S # t        $ r |cY S w xY w)zQuery for the next available utility.

    Find the next available utility providing `interface` and having the
    specified name. If no utility was found, return the specified `default`
    value.
    )r   r	   	__bases__rA   _marker)r   r   r,   r)   smbasesr   utils           r   queryNextUtilityrP      si    G$ LLE   D':wK N   s   A AAc                     t        | ||t              }|t        u r0t        j                  j                  j                  d|d|d      |S )zfGet the next available utility.

    If no utility was found, a `ComponentLookupError` is raised.
    zNo more utilities for z, 'z' have been found.)rP   rL   zope	component
interfacesr	   )r   r   r,   rO   s       r   getNextUtilityrU      sI    
 GYg>Dwnn''<<T#$ 	$ Kr   c                 T    |j                  dd      } t        t        | |      |i |S )zkInvoke the named factory and return the result.

    ``__factory_name`` is a positional-only argument.
    r   N)poprC   r   )__factory_namer   kwargsr   s       r   createObjectrZ      s/    
 jjD)G8:h8$I&IIr   c                 @    t        t        | |      j                         S )znReturn the interface provided by the named factory's objects

    Result might be a single interface. XXX
    )rC   r   getInterfaces)r,   r   s     r   getFactoryInterfacesr]      s    
 hg.<<>>r   c              #   
  K   t        |      }|j                  t              D ]-  \  }}|j                         }	 |j	                  |       r||f / y# t
        $ r# |D ]  }|j	                  |       s||f  n Y \w xY ww)zCReturn info on all factories implementing the given interface.
    N)r   rF   r   r\   isOrExtendsAttributeError)r   r   utilsr,   factoryrT   ifaces          r   getFactoriesForrd      s      7#E 00: 	w**,
	%%i0Gm#		
  	# $$Y/-'	s.   7BABB 4	B =B?B  Br   )r#   N)r#   NN)r#   )3__doc__r%   typeszope.interfacer   r   r   zope.component.interfacesr   r   r   r	   r
   zope.component._compatr   zope.component._declarationr   r   r   zope.hookabler   ImportErrorzope.component.hookabler   r   r   r   r-   r(   r4   r2   r8   r<   r>   r/   zope.interface.interfacerR   r   adapter_hooksappendrC   rA   rF   rI   r   rL   rP   rU   rZ   r]   rd    r   r   <module>rr      s5   
  $ ( % < G . : 6 ) 1 / .1& 	4 
4$P6 "+  $-649 (1vt  *3"L674 
F 
F      & & - -l ;0J>K (&
J?I  101s   C< <D
	D
