
    Bh                     x    d dl mZ d dlmZ d dlmZ d dlmZm	Z	m
Z
mZ  G d de      Z G d d      Z e       Zy	)
    )apps)gettext)RemovedInDjangoCMS51Warning)Wizardentry_choicesget_entries	get_entryc                       e Zd Zy)AlreadyRegisteredExceptionN)__name__
__module____qualname__     G/home/dcms/DCMS/lib/python3.12/site-packages/cms/wizards/wizard_pool.pyr   r      s    r   r   c                   (    e Zd ZdZd Zd Zd Zd Zy)
WizardPoolz
    .. deprecated:: 4.0
    c                 l    |j                   t        j                  d      j                  j                  v S )z`
        .. deprecated:: 4.0

        Returns True if the provided entry is registered.
        cms)idr   get_app_configcms_extensionwizards)selfentrykwargss      r   is_registeredzWizardPool.is_registered   s*     xx4..u5CCKKKKr   c                 ^   ddl }|j                  dt        d       t        |t              sJ d       | j                  |d      r1|j                         }t        t        d	      |j                  z        |t        j                  d
      j                  j                  |j                  <   y)am  
        .. deprecated:: 4.0

        You may notice from the example above that the last line in the sample code is::

            wizard_pool.register(my_app_wizard)

        This sort of thing should look very familiar, as a similar approach is used for
        cms_apps, template tags and even Django's admin.

        Calling the wizard pool's ``register`` method will register the provided wizard
        into the pool, unless there is already a wizard of the same module and class
        name. In this case, the register method will raise a
        ``cms.wizards.wizard_pool.AlreadyRegisteredException``.
        r   Nz<Using wizard_pool is deprecated. Use the cms_config instead.   )
stacklevel#entry must be an instance of WizardT)passivez2A wizard has already been registered for model: %sr   )warningswarnr   
isinstancer   r   	get_modelr   _r   r   r   r   r   r   )r   r   r#   models       r   registerzWizardPool.register   s      	J' 	 	

 %(O*OO(eT2OO%E,FG    JOD&44<<UXXFr   c                     t        |t              sJ d       | j                  |      r5t        j                  d      j
                  j                  |j                  = yy)u   
        .. deprecated:: 4.0

        If «entry» is registered into the pool, remove it.

        Returns True if the entry was successfully registered, else False.
        r!   r   TF)r%   r   r   r   r   r   r   r   r   r   s     r   
unregisterzWizardPool.unregister:   sQ     %(O*OO(e$##E*88@@Jr   c                     t        |      S )u  
        .. deprecated:: 4.0 use :func:`cms.wizards.helpers.get_entry` instead

        Returns the wizard from the pool identified by «entry», which may be a
        Wizard instance or its "id" (which is the PK of its underlying
        content-type).
        )r	   r+   s     r   r	   zWizardPool.get_entryI   s     r   N)r   r   r   __doc__r   r)   r,   r	   r   r   r   r   r      s    LO@	 r   r   N)django.appsr   django.utils.translationr   r'   cms.utils.compat.warningsr   cms.wizards.wizard_baser   r   r   r	   	Exceptionr   r   wizard_poolr   r   r   <module>r5      s;     1 A Q Q	 	F  F R lr   