
    sh                         d Z dZdZddlZddlZddlmZ ddlmZ ddl	m
Z
mZ 	 deeeeedf   d	efd
Zd	efdZd	efdZy)zCopyright 2021, 3LizzGPL version 3zinfo@3liz.org    N)Path)Union)QgisQgsMessageLogvalreturnc                 \    t        | t              r| j                         dv S t        |       S )z( Convert lizmap config value to boolean )yestruet1)
isinstancestrlowerbool)r   s    3/var/www/qgis-server/plugins/lizmap_server/tools.pyto_boolr      s(    #syy{777Cy    c                  .   t        t              j                  j                  d      } t	        j
                         }	 |j                  | d       |d   d   S # t        $ r2 t        j                  ddt        j                  j                         Y yw xY w)	z% Returns the Lizmap current version. zmetadata.txtutf8)encodinggeneralversionzqError, an UnicodeDecodeError occurred while reading the metadata.txt. Is the locale correctly set on the server ?LizmapNULL)r   __file__parentjoinpathconfigparserConfigParserreadUnicodeDecodeErrorr   
logMessager   MessageLevelCritical)	file_pathconfigs     r   r   r      s    X%%..~>I&&(F,I/ i ++  	
 	  ,d''00	2 	s   A 8BBc                      t        t        j                  j                  dd            s0t	        j
                  ddt        j                  j                         yy)z! Check the server configuration. "QGIS_SERVER_LIZMAP_REVEAL_SETTINGS u   The Lizmap API is currently not enabled. Please read the documentation how to enable the Lizmap API on QGIS server side https://docs.lizmap.com/current/en/install/pre_requirements.html#lizmap-server-plugin An environment variable must be enabled to have Lizmap Web Client ≥ 3.5 working.r   FT)	r   osenvirongetr   r#   r   r$   r%    r   r   check_environment_variabler/   /   sJ    2::>>"FKL  a &&	
 r   )__copyright____license__	__email__r   r+   pathlibr   typingr   	qgis.corer   r   r   intfloatr   r   r   r/   r.   r   r   <module>r8      sc   &	  	   )
sCd23  , ,(D r   