Open files in mode utf8
This commit is contained in:
@@ -1486,7 +1486,7 @@ def checkWildcardExist(self, wo_domain_name):
|
|||||||
# define new csv dialect
|
# define new csv dialect
|
||||||
csv.register_dialect('acmeconf', delimiter='|')
|
csv.register_dialect('acmeconf', delimiter='|')
|
||||||
# open file
|
# open file
|
||||||
certfile = open('/var/lib/wo/cert.csv', 'rt')
|
certfile = open('/var/lib/wo/cert.csv', mode='rt', encoding='utf-8')
|
||||||
reader = csv.reader(certfile, 'acmeconf')
|
reader = csv.reader(certfile, 'acmeconf')
|
||||||
wo_wildcard_domain = ("*.{0}".format(wo_domain_name))
|
wo_wildcard_domain = ("*.{0}".format(wo_domain_name))
|
||||||
for row in reader:
|
for row in reader:
|
||||||
|
|||||||
@@ -32,10 +32,11 @@ def GetDomainlevel(domain):
|
|||||||
domain_name = domain.split('.')
|
domain_name = domain.split('.')
|
||||||
if domain_name[0] == 'www':
|
if domain_name[0] == 'www':
|
||||||
domain_name = domain_name[1:]
|
domain_name = domain_name[1:]
|
||||||
|
domain_type = ''
|
||||||
if os.path.isfile("/var/lib/wo/public_suffix_list.dat"):
|
if os.path.isfile("/var/lib/wo/public_suffix_list.dat"):
|
||||||
# Read mode opens a file for reading only.
|
# Read mode opens a file for reading only.
|
||||||
Suffix_file = open(
|
Suffix_file = open(
|
||||||
"/var/lib/wo/public_suffix_list.dat", "r")
|
"/var/lib/wo/public_suffix_list.dat", mode='rt', encoding='utf-8')
|
||||||
# Read all the lines into a list.
|
# Read all the lines into a list.
|
||||||
for domain_suffix in Suffix_file:
|
for domain_suffix in Suffix_file:
|
||||||
if (str(domain_suffix).strip()) == ('.'.join(domain_name[1:])):
|
if (str(domain_suffix).strip()) == ('.'.join(domain_name[1:])):
|
||||||
|
|||||||
Reference in New Issue
Block a user