B
    ê¹`K  ã               @   s(   d Z dd„ Zdd„ Zdd„ Zdd„ Zd	S )
zCView decorators to expose useful response "variables" to templates
c             C   s<   | j jd d  ¡ }| dtƒ ¡ | |d ¡ ||d< dS )zpMerge the urls in the settings with the urls put into the
    the pgwui portion of the response by the view
    ÚpgwuiÚurlsN)ÚregistryÚsettingsÚcopyÚ
setdefaultÚdictÚupdate)Úrequestr   r   © r
   úY/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/pgwui_common/view.pyÚ
merge_urls   s    r   c                s   ‡ fdd„}|S )z3Decorator for any view which includes base.mk.
    c                s*   ˆ | ƒ}|  di ¡}t| |ƒ ||d< |S )zEAdd variables missing but needed by base.mk to the response.
        r   )Úgetr   )r	   Úresponser   )Úwrappedr
   r   Úwrapper'   s
    
zbase_view.<locals>.wrapperr
   )r   r   r
   )r   r   Ú	base_view$   s    r   c                s   ‡ fdd„}|S )z:Decorator for any view which includes errors_base.mk.
    c                s   t ˆ ƒ| ƒS )z@Add variables needed by errors_base.mk to the response.
        )r   )r	   )r   r
   r   r   5   s    z!errors_base_view.<locals>.wrapperr
   )r   r   r
   )r   r   Úerrors_base_view2   s    r   c                s   ‡ fdd„}|S )z8Decorator for any view which includes auth_base.mk.
    c                s   t ˆ ƒ| ƒS )z>Add variables needed by auth_base.mk to the response.
        )r   )r	   )r   r
   r   r   ?   s    zauth_base_view.<locals>.wrapperr
   )r   r   r
   )r   r   Úauth_base_view<   s    r   N)Ú__doc__r   r   r   r   r
   r
   r
   r   Ú<module>   s   

