B
    DDb  ã               @   s,   d dl mZ d
dd„Zddd„Zdd	„ ZdS )é    )ÚHttpResponseNc       	      C   sš   ddl m} ddlm} ddlm} |s,t}| dt|ƒ ¡}|rR|| | |¡ƒS |j	j
|d ¡ }|r–||ƒ}| dt|ƒ |d¡ || | |¡ƒS |S )Nr   )Úmodel_to_dict)Úcache)ÚDeviceConfigZdevice_config_)Ú
company_idi€:	 )Zdjango.formsr   Zdjango.core.cacher   Zmysite.iclock.modelsr   ÚintÚgetÚstrZobjectsÚfilterÚfirstÚset)	ZparamÚdefaultZtransferr   r   r   r   ZparamsZdc© r   ú1G:\easytimepro\master/mysite/iclock\comm\utils.pyÚget_comm_setting	   s    r   ú
text/plainc             C   s   t | d}d|d< d|d< |S )N)Úcontent_typezno-cacheZPragmazno-storezCache-Control)r   )r   Zresponser   r   r   Úheader_response   s    
r   c             C   s   | j  dd ¡}|ddfS )NZSNTZcommkey)ZGETr   )ZrequestÚproduct_typeZsnr   r   r   Úsn_valid_check!   s    r   )r   NN)r   )Zdjango.http.responser   r   r   r   r   r   r   r   Ú<module>   s   

