eric6/E5Network/E5TldExtractor.py

changeset 7253
50dbe65a1334
parent 7229
53054eb5b15a
child 7360
9190402e4505
equal deleted inserted replaced
7252:c5e3705073eb 7253:50dbe65a1334
271 271
272 dataFileName = "" 272 dataFileName = ""
273 parsedDataFileExist = False 273 parsedDataFileExist = False
274 274
275 for path in self.__dataSearchPaths: 275 for path in self.__dataSearchPaths:
276 dataFileName = QFileInfo(path + "/effective_tld_names.dat")\ 276 dataFileName = (
277 .absoluteFilePath() 277 QFileInfo(path + "/effective_tld_names.dat").absoluteFilePath()
278 )
278 if QFileInfo(dataFileName).exists(): 279 if QFileInfo(dataFileName).exists():
279 parsedDataFileExist = True 280 parsedDataFileExist = True
280 break 281 break
281 282
282 if not parsedDataFileExist: 283 if not parsedDataFileExist:
283 tldDataFileDownloadLink = \ 284 tldDataFileDownloadLink = (
284 "http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/" \ 285 "http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/"
285 "effective_tld_names.dat?raw=1" 286 "effective_tld_names.dat?raw=1"
287 )
286 E5MessageBox.information( 288 E5MessageBox.information(
287 None, 289 None,
288 self.tr("TLD Data File not found"), 290 self.tr("TLD Data File not found"),
289 self.tr("""<p>The file 'effective_tld_names.dat' was not""" 291 self.tr("""<p>The file 'effective_tld_names.dat' was not"""
290 """ found!<br/>You can download it from """ 292 """ found!<br/>You can download it from """
334 336
335 if line.startswith("//"): 337 if line.startswith("//"):
336 if "===END PRIVATE DOMAINS===" in line: 338 if "===END PRIVATE DOMAINS===" in line:
337 seekToEndOfPrivateDomains = False 339 seekToEndOfPrivateDomains = False
338 340
339 if not loadPrivateDomains and \ 341 if (
340 "===BEGIN PRIVATE DOMAINS===" in line: 342 not loadPrivateDomains and
343 "===BEGIN PRIVATE DOMAINS===" in line
344 ):
341 seekToEndOfPrivateDomains = True 345 seekToEndOfPrivateDomains = True
342 346
343 continue 347 continue
344 348
345 if seekToEndOfPrivateDomains: 349 if seekToEndOfPrivateDomains:
447 451
448 testDataFileName = "" 452 testDataFileName = ""
449 testDataFileExist = False 453 testDataFileExist = False
450 454
451 for path in self.__dataSearchPaths: 455 for path in self.__dataSearchPaths:
452 testDataFileName = QFileInfo(path + "/test_psl.txt")\ 456 testDataFileName = (
453 .absoluteFilePath() 457 QFileInfo(path + "/test_psl.txt").absoluteFilePath()
458 )
454 if QFileInfo(testDataFileName).exists(): 459 if QFileInfo(testDataFileName).exists():
455 testDataFileExist = True 460 testDataFileExist = True
456 break 461 break
457 462
458 if not testDataFileExist: 463 if not testDataFileExist:
459 testFileDownloadLink = \ 464 testFileDownloadLink = (
460 "http://mxr.mozilla.org/mozilla-central/source/netwerk/test/" \ 465 "http://mxr.mozilla.org/mozilla-central/source/netwerk/test/"
461 "unit/data/test_psl.txt?raw=1" 466 "unit/data/test_psl.txt?raw=1"
467 )
462 E5MessageBox.information( 468 E5MessageBox.information(
463 None, 469 None,
464 self.tr("TLD Data File not found"), 470 self.tr("TLD Data File not found"),
465 self.tr("""<p>The file 'test_psl.txt' was not found!""" 471 self.tr("""<p>The file 'test_psl.txt' was not found!"""
466 """<br/>You can download it from '<a href="{0}">""" 472 """<br/>You can download it from '<a href="{0}">"""

eric ide

mercurial