@@ -221,13 +221,13 @@ def config_for_id(auth_id: str) -> Optional[QgsAuthMethodConfig]:
221
221
""" Fetch the authentication settings for a given token. """
222
222
auth_manager = QgsApplication .authManager ()
223
223
if not auth_manager .masterPasswordIsSet ():
224
- LOGGER .warning ("Master password is not set, could not look for ID {}" . format ( auth_id ) )
224
+ LOGGER .warning (f "Master password is not set, could not look for ID { auth_id } " )
225
225
return None
226
226
227
227
conf = QgsAuthMethodConfig ()
228
228
auth_manager .loadAuthenticationConfig (auth_id , conf , True )
229
229
if not conf .id ():
230
- LOGGER .debug ("Skipping password ID {}, it wasn't found in the password manager" . format ( auth_id ) )
230
+ LOGGER .debug (f "Skipping password ID { auth_id } , it wasn't found in the password manager" )
231
231
return None
232
232
233
233
# LOGGER.info("Found password ID {}".format(auth_id))
@@ -248,7 +248,7 @@ def clean_cache(cls, force=False):
248
248
def cache_file_for_name (cls , name : str ) -> Path :
249
249
""" Return a cache file name according to a server name. """
250
250
name = name .replace ('/' , '-' )
251
- cache_file = lizmap_user_folder ().joinpath ("cache_server_metadata" ).joinpath ('{ }.json'. format ( name ) )
251
+ cache_file = lizmap_user_folder ().joinpath ("cache_server_metadata" ).joinpath (f' { name } .json' )
252
252
return cache_file
253
253
254
254
def check_validity_servers (self ) -> bool :
@@ -401,7 +401,7 @@ def remove_row(self):
401
401
QMessageBox .StandardButton .Ok )
402
402
self .table .clearSelection ()
403
403
return
404
- LOGGER .debug ("Row {} removed from the QGIS authentication database" . format ( auth_id ) )
404
+ LOGGER .debug (f "Row { auth_id } removed from the QGIS authentication database" )
405
405
406
406
self .table .clearSelection ()
407
407
self .table .removeRow (row )
@@ -503,13 +503,14 @@ def fetch(self, url: str, auth_id: str, row: int):
503
503
self .fetchers [row ].finished .connect (partial (self .request_finished , row ))
504
504
505
505
if auth_id :
506
- QgsMessageLog .logMessage ("Using the token for <a href='{0 }'>{0 }</a>" . format ( url ) , "Lizmap" , Qgis .Info )
506
+ QgsMessageLog .logMessage (f "Using the token for <a href='{ url } '>{ url } </a>" , "Lizmap" , Qgis .Info )
507
507
508
508
request = QNetworkRequest ()
509
509
request .setUrl (QUrl (ServerWizard .url_metadata (url )))
510
510
request .setAttribute (QNetworkRequest .FollowRedirectsAttribute , True )
511
511
# According to QGIS debug panel, this is not working for now
512
- request .setAttribute (QNetworkRequest .Attribute .CacheLoadControlAttribute , QNetworkRequest .CacheLoadControl .PreferNetwork )
512
+ request .setAttribute (
513
+ QNetworkRequest .Attribute .CacheLoadControlAttribute , QNetworkRequest .CacheLoadControl .PreferNetwork )
513
514
self .fetchers [row ].fetchContent (request , auth_id )
514
515
515
516
def request_finished (self , row : int ):
@@ -631,7 +632,7 @@ def request_finished(self, row: int):
631
632
# Add the JSON metadata in the server combobox
632
633
index = self .server_combo .findData (url , ServerComboData .ServerUrl .value )
633
634
self .server_combo .setItemData (index , content , ServerComboData .JsonMetadata .value )
634
- LOGGER .info ("Saving server metadata from network : {} - {}" . format ( index , server_alias ) )
635
+ LOGGER .info (f "Saving server metadata from network : { index } - { server_alias } " )
635
636
self .parent .tooltip_server_combo (index )
636
637
# Server combo is refreshed, maybe we can allow the menu bar
637
638
self .check_dialog_validity ()
@@ -640,10 +641,16 @@ def request_finished(self, row: int):
640
641
if self .server_combo .currentData (ServerComboData .ServerUrl .value ) == url :
641
642
self .parent .refresh_combo_repositories ()
642
643
644
+ lwc_version_txt = f'* Lizmap Web Client : { lizmap_version } '
645
+ git_hash = info .get ('commit' )
646
+ if git_hash :
647
+ lwc_version_txt += f" - commit { git_hash } https://github.com/3liz/lizmap-web-client/commit/{ git_hash } "
648
+ lwc_version_txt += '\n '
649
+
643
650
# Markdown
644
651
markdown = '**Versions :**\n \n '
645
- markdown += '* Lizmap Web Client : {} \n ' . format ( lizmap_version )
646
- markdown += '* Lizmap plugin : {}\n ' . format ( version ())
652
+ markdown += lwc_version_txt
653
+ markdown += f '* Lizmap plugin : { version () } \n '
647
654
markdown += '* QGIS Desktop : {}\n ' .format (Qgis .QGIS_VERSION .split ('-' )[0 ])
648
655
qgis_cell .setData (Qt .UserRole , markdown )
649
656
qgis_cell .setData (Qt .UserRole + 1 , content )
@@ -674,17 +681,21 @@ def request_finished(self, row: int):
674
681
plugins = qgis_server_info .get ('plugins' )
675
682
# plugins = {'atlasprint': {'version': '3.2.2'}}
676
683
# Temporary, add plugins as markdown in the data
677
- markdown += '* QGIS Server : {}\n ' . format ( qgis_server_version )
684
+ markdown += f '* QGIS Server : { qgis_server_version } \n '
678
685
py_qgis = qgis_server_info .get ('py_qgis_server' )
679
686
if py_qgis :
680
687
py_qgis_version = py_qgis .get ('version' , 'Not used' )
681
688
else :
682
689
# Legacy, old server running
683
690
py_qgis_version = qgis_metadata .get ('py_qgis_server_version' , 'Not used' )
684
691
685
- markdown += '* Py-QGIS-Server : {}\n ' . format ( py_qgis_version )
692
+ markdown += f '* Py-QGIS-Server : { py_qgis_version } \n '
686
693
for plugin , info in plugins .items ():
687
- markdown += '* QGIS Server plugin {} : {}\n ' .format (plugin , info ['version' ])
694
+ plugin_version = info ['version' ]
695
+ if plugin_version .lower ().startswith ("not" ):
696
+ # https://github.com/3liz/qgis-lizmap-server-plugin/commit/4e8e8c51102470eac0dc2ec622db9ab41d37f1c1
697
+ continue
698
+ markdown += f'* QGIS Server plugin { plugin } : { plugin_version } \n '
688
699
689
700
markdown += self .modules_to_markdown (content )
690
701
qgis_cell .setData (Qt .UserRole , markdown )
@@ -755,9 +766,12 @@ def modules_to_markdown(cls, content: dict) -> str:
755
766
text += '<summary>List of Lizmap Web Client modules :</summary>\n '
756
767
text += '<br/>\n '
757
768
modules = content .get ("modules" )
758
- if modules :
759
- for module , info in modules .items ():
760
- text += f'* { module } : { info .get ("version" , "" )} \n '
769
+ if isinstance (modules , dict ):
770
+ if len (modules .keys ()) >= 1 :
771
+ for module , info in modules .items ():
772
+ text += f'* { module } : { info .get ("version" , "" )} \n '
773
+ else :
774
+ text += '* No module\n '
761
775
else :
762
776
text += '* Version Lizmap Web Client 3.8 needed\n '
763
777
text += '</details>\n '
@@ -804,11 +818,11 @@ def refresh_server_combo(self):
804
818
with open (cache_file , encoding = 'utf8' ) as f :
805
819
metadata = json .load (f )
806
820
self .server_combo .setItemData (index , metadata , ServerComboData .JsonMetadata .value )
807
- LOGGER .info ("Loading server <a href='{}'>{}</a> using cache in the drop down list" . format ( url , name ) )
821
+ LOGGER .info (f "Loading server <a href='{ url } '>{ name } </a> using cache in the drop down list" )
808
822
else :
809
823
self .server_combo .setItemData (index , {}, ServerComboData .JsonMetadata .value )
810
824
LOGGER .info (
811
- "Loading server <a href='{}'>{}</a> without metadata in the drop down list" . format ( url , name ) )
825
+ f "Loading server <a href='{ url } '>{ name } </a> without metadata in the drop down list" )
812
826
813
827
self .parent .tooltip_server_combo (index )
814
828
@@ -905,10 +919,11 @@ def _messages_for_version(
905
919
split_version = lizmap_version .split ('.' )
906
920
if len (split_version ) not in (3 , 4 ):
907
921
# 3.4.0-pre but also 3.4.0-rc.1
922
+ # noinspection PyTypeChecker
908
923
QgsMessageLog .logMessage (
909
- "The version '{}' is not correct." . format ( lizmap_version ) , "Lizmap" , Qgis .Critical )
924
+ f "The version '{ lizmap_version } ' is not correct." , "Lizmap" , Qgis .Critical )
910
925
911
- branch = '{}.{}' . format ( split_version [0 ], split_version [1 ])
926
+ branch = f' { split_version [0 ]} . { split_version [1 ]} '
912
927
full_version = '{}.{}' .format (branch , split_version [2 ].split ('-' )[0 ])
913
928
914
929
messages = []
@@ -1008,10 +1023,12 @@ def _messages_for_version(
1008
1023
messages .append (tr ("Running a .0 version, upgrade to the latest bugfix release" ))
1009
1024
elif bugfix != 0 and status in (ReleaseStatus .ReleaseCandidate , ReleaseStatus .Stable , ReleaseStatus .SecurityBugfixOnly , ReleaseStatus .Retired ):
1010
1025
# Even if the branch is retired, we encourage people upgrading to the latest
1011
- messages .append (
1012
- tr (
1013
- 'Not latest bugfix release, {version} is available'
1014
- ).format (version = json_version ['latest_release_version' ]))
1026
+ if not lizmap_cloud :
1027
+ # Only advertise if it's not a customer
1028
+ messages .append (
1029
+ tr (
1030
+ 'Not latest bugfix release, {version} is available'
1031
+ ).format (version = json_version ['latest_release_version' ]))
1015
1032
1016
1033
if is_pre_package :
1017
1034
# Pre-release, maybe the package got some updates
@@ -1295,7 +1312,7 @@ def migrate_password_manager(self, servers: list):
1295
1312
1296
1313
if '@{}' .format (url ) in conf .name ():
1297
1314
# Old format
1298
- LOGGER .warning ("Migrating the URL {} in the QGIS authentication database" . format ( url ) )
1315
+ LOGGER .warning (f "Migrating the URL { url } in the QGIS authentication database" )
1299
1316
user = conf .config ('username' )
1300
1317
password = conf .config ('password' )
1301
1318
@@ -1328,7 +1345,7 @@ def migrate_password_manager(self, servers: list):
1328
1345
split = conf .name ().split ('@' )
1329
1346
if QUrl (split [- 1 ]).isValid ():
1330
1347
LOGGER .critical (
1331
- "Is the password ID '{}' in the QGIS authentication database a Lizmap server URL ? If yes, "
1332
- "please remove it manually, otherwise skip this message. Go in the QGIS global properties, "
1333
- "then 'Authentication' panel and check this ID." . format ( config )
1348
+ f "Is the password ID '{ config } ' in the QGIS authentication database a Lizmap server URL ? If yes, "
1349
+ f "please remove it manually, otherwise skip this message. Go in the QGIS global properties, "
1350
+ f "then 'Authentication' panel and check this ID."
1334
1351
)
0 commit comments