a
    ºE`ô  ã                   @   sn   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 G dd„ deƒZd	d
„ Zddd„ZdS )é    )ÚHttpResponse)Úloader)ÚTemplate)Úgettext)ÚTemplateDoesNotExist)ÚRecordModifiedErrorc                   @   s   e Zd ZdZdS )ÚConflictResponsei™  N)Ú__name__Ú
__module__Ú__qualname__Zstatus_code© r   r   úN/home/httpd/docs/test/DocsMgr/lib/python3.9/site-packages/concurrency/views.pyr   
   s   r   c                 O   s   t tdƒ| d�‚d S )NzRecord has been modified)Útarget)r   Ú_)r   ÚargsÚkwargsr   r   r   Úcallback   s    r   Nú409.htmlc                 C   sx   zt  |¡}W n ty(   tdƒ}Y n0 z|jjj|jd�}W n |jjyZ   d}Y n0 ||| j	dœ}t
| |¡ƒS )z�409 error handler.

    :param request: Request

    :param template_name: `409.html`

    :param target: The model to save

    zr<h1>Conflict</h1><p>The request was unsuccessful due to a conflict. The object changed during the transaction.</p>)ÚpkN)r   ÚsavedZrequest_path)r   Zget_templater   r   Ú	__class__Z_default_managerÚgetr   ZDoesNotExistÚpathr   Zrender)Zrequestr   Ztemplate_nameÚtemplater   Úctxr   r   r   Úconflict   s    
ÿ

þr   )Nr   )Zdjango.httpr   Zdjango.templater   Zdjango.template.baser   Zdjango.utils.translationr   r   Zconcurrency.compatr   Zconcurrency.exceptionsr   r   r   r   r   r   r   r   Ú<module>   s   