o
    i                     @   s@   d Z ddlZeeZddlmZ dddZG dd deZ	dS )	zBase class and other helper methods for Auxiliary Method Processors
('AuxProc's for short). AuxProcs define how an auxiliary method is going to be
executed.
    N)AuxMethodContextc                 C   sB   |D ]}|j j||| |du s|j jjr|j j| | qdS )z-Method to be called in the auxiliary context.N)
descriptorauxinitialize_contextprocess_exceptionsprocess_context)servercontextsp_ctxerrorctx r   S/var/www/html/LicenciasMIG/venv/lib/python3.10/site-packages/spyne/auxproc/_base.pyprocess_contexts    s   r   c                   @   s6   e Zd ZdddZdd Zdd Zdd	 Zd
d ZdS )AuxProcBaseFc                 C   s   g | _ || _dS )zAbstract Base class shared by all AuxProcs.

        :param process_exceptions: If false, does not execute auxiliary methods
        when the main method throws an exception.
        N)methodsr   )selfr   r   r   r   __init__*   s   
zAuxProcBase.__init__c                 O   sn   | | |jdurt|j |jS || |jdur&t|j |jS || |jD ]}q.|  dS )znThe method that does the actual processing. This should be called
        from the auxiliary context.
        N)	get_in_objectin_errorlogger	exceptionget_out_object	out_errorget_out_string
out_stringclose)r   r   r   argskwargssr   r   r   process4   s   





zAuxProcBase.processc                 C   s   t  )z8Override this to implement your own auxiliary processor.)NotImplementedError)r   r   r   r
   p_errorr   r   r   r   I   s   zAuxProcBase.process_contextc                 C   s   dS )zOverride this method to make arbitrary initialization of your
        AuxProc. It's called once, 'as late as possible' into the Application
        initialization.Nr   )r   r   r   r   r   
initializeN   s    zAuxProcBase.initializec                 C   s   t |||_dS )zOverride this method to alter thow the auxiliary method context is
        initialized. It's called every time the method is executed.
        N)r   r   )r   r   r
   r   r   r   r   r   S   s   zAuxProcBase.initialize_contextN)F)__name__
__module____qualname__r   r    r   r#   r   r   r   r   r   r   )   s    

r   )N)
__doc__logging	getLoggerr$   r   spyner   r   objectr   r   r   r   r   <module>   s   

	