Commit 8081d71f authored by Markus Uehlein's avatar Markus Uehlein

checking if fsr and fsr_extern is a file

parent 7f3350e8
......@@ -112,24 +112,34 @@ class FsrLdap:
def get_fallback_fsr(share_dir):
"""get fsr form fallback file"""
return sorted([re.sub(re.escape('\t'), ' ',
line.rstrip('\n'))
for line in codecs.open(os.path.join(share_dir,
'fsr'),
'r',
'utf-8').readlines()],
key=lambda x: ''.join(x.split(' ')[::-1]))
if os.path.isfile(os.path.join(share_dir, 'fsr')):
return sorted([re.sub(re.escape('\t'), ' ',
line.rstrip('\n'))
for line in codecs.open(os.path.join(share_dir,
'fsr'),
'r',
'utf-8').readlines()],
key=lambda x: ''.join(x.split(' ')[::-1]))
else:
print(os.path.abspath(os.path.join(share_dir, 'fsr'))
+ ' not found. Using empty FSR.')
return []
def get_fallback_fsr_extern(share_dir):
"""get fsr_extern from fallback file"""
return sorted([re.sub(re.escape('\t'), ' ',
line.rstrip('\n'))
for line in codecs.open(os.path.join(share_dir,
'fsr_extern'),
'r',
'utf-8').readlines()],
key=lambda x: ''.join(x.split(' ')[::-1]))
if os.path.isfile(os.path.join(share_dir, 'fsr_extern')):
return sorted([re.sub(re.escape('\t'), ' ',
line.rstrip('\n'))
for line in codecs.open(os.path.join(share_dir,
'fsr_extern'),
'r',
'utf-8').readlines()],
key=lambda x: ''.join(x.split(' ')[::-1]))
else:
print(os.path.abspath(os.path.join(share_dir, 'fsr_extern'))
+ ' not found. Using empty FSR_extern.')
return []
def get_sprecher(sprecher):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment