Commit 91c56080 authored by Lorenz Steinert's avatar Lorenz Steinert

if -VV is supplied Anwesenheitsliste is not printed

parent cf3fbe44
......@@ -11,8 +11,8 @@ import os
import sys
import shutil
import time
import ldap3 as ldap
import codecs
import ldap3 as ldap
try:
import pwd
......@@ -65,18 +65,28 @@ class Protokollskript:
self.reg_acroname = re.compile("%%ACRONAME")
self.reg_fsrname = re.compile("%%FSRNAME")
self.fsr = sorted([re.sub(re.escape('\t'), ' ', line.rstrip('\n'))
for line in codecs.open('./fsr', 'r', 'utf-8').readlines()], key=lambda x: ''.join(x.split(' ')[::-1]))
self.fsr_extern = sorted([re.sub(re.escape('\t'), ' ', line.rstrip('\n'))
for line in codecs.open('./fsr_extern', 'r', 'utf-8').readlines()], key=lambda x: ''.join(x.split(' ')[::-1]))
self.opt = {'-d':0}
self.fsr = sorted([re.sub(re.escape('\t'),
' ',
line.rstrip('\n'))
for line in codecs.open('./fsr',
'r',
'utf-8').readlines()],
key=lambda x: ''.join(x.split(' ')[::-1]))
self.fsr_extern = sorted([re.sub(re.escape('\t'),
' ',
line.rstrip('\n'))
for line in codecs.open('./fsr_extern', 'r',
'utf-8').readlines()],
key=lambda x: ''.join(x.split(' ')[::-1]))
self.opt = {'-d': 0, '-VV': 0}
for i in opt[1:]:
if i in self.opt.keys():
self.opt[i] = 1
else:
print(i + ' ist keine Option für das Protokollskript.\nVerfügbare Optionen sind: \n' + str(list(self.opt.keys())))
print(i + ' ist keine Option für das Protokollskript. \
\nVerfügbare Optionen sind: \n' + str(list(self.opt.keys())))
raise SystemExit(0)
def clean_string(self, data):
......@@ -102,7 +112,8 @@ class Protokollskript:
return protokollant
except ldap.core.exceptions.LDAPException as error_message:
if self.opt['-d'] == 1:
print("Couldn't Connect to ldap.\nUsing fallback default.\n %s " % error_message)
print("Couldn't Connect to ldap.\n \
Using fallback default.\n %s " % error_message)
else:
print("Couldn't Connect to ldap.\nUsing fallback default.")
return protokollant
......@@ -242,88 +253,90 @@ class Protokollskript:
f_foot = self.reg_date.sub(self.date, f_foot)
msg = ""
msg += f_head
#fobj_out.write(f_head)
msg += "~\\newline\n"
#fobj_out.write("~\\newline\n")
tabdef = "||"
for i in range(self.num_cols):
tabdef += "c|l||"
msg += "FSR-Mitglieder\\\\\n\\\\\n\\scriptsize{\\begin{tabular}{" \
+ tabdef + "}\n\\hline\n"
#fobj_out.write("FSR-Mitglieder\\\\\n\\\\\n\\scriptsize{\\begin{tabular}{"
#+ tabdef + "}\n\\hline\n")
for i in zip(self.fsr, range(len(self.fsr))):
if i[1] % self.num_cols == 0:
msg += " "
#fobj_out.write(" ")
else:
msg += "&"
#fobj_out.write("&")
if "Sarah" in i[0]:
msg += r" &Sarah Anna Kova\v{c}"
#fobj_out.write(r" &Sarah Anna Kova\v{c}")
else:
msg += " &" + i[0]
#fobj_out.write(" &" + i[0])
if i[1] % self.num_cols == self.num_cols - 1:
if self.opt['-VV']:
tabdef = "||"
for i in range(self.num_cols):
tabdef += "c|l||"
msg += "FSR-Mitglieder\\\\\n\\\\\n\\scriptsize{\\begin{tabular}{" \
+ tabdef + "}\n\\hline\n"
#fobj_out.write("FSR-Mitglieder\\\\\n\\\\\n\\scriptsize{\\begin{tabular}{"
#+ tabdef + "}\n\\hline\n")
for i in zip(self.fsr, range(len(self.fsr))):
if i[1] % self.num_cols == 0:
msg += " "
#fobj_out.write(" ")
else:
msg += "&"
#fobj_out.write("&")
if "Sarah" in i[0]:
msg += r" &Sarah Anna Kova\v{c}"
#fobj_out.write(r" &Sarah Anna Kova\v{c}")
else:
msg += " &" + i[0]
#fobj_out.write(" &" + i[0])
if i[1] % self.num_cols == self.num_cols - 1:
msg += "\\\\\\hline\n"
#fobj_out.write("\\\\\\hline\n")
else:
msg += "\n"
#fobj_out.write("\n")
if not len(self.fsr)%self.num_cols == 0:
for i in range(self.num_cols - len(self.fsr)%self.num_cols):
msg += "& &\n"
#fobj_out.write("& &\n")
msg += "\\\\\\hline\n"
#fobj_out.write("\\\\\\hline\n")
else:
msg += "\n"
#fobj_out.write("\n")
if not len(self.fsr)%self.num_cols==0:
for i in range(self.num_cols - len(self.fsr)%self.num_cols):
msg += "& &\n"
#fobj_out.write("& &\n")
msg += "\\\\\\hline\n"
#fobj_out.write("\\\\\\hline\n")
msg += r"\end{tabular}}\normalsize\vspace{1em}"
msg += "\n\\newline\n"
#fobj_out.write(r"\end{tabular}}\normalsize\vspace{1em}")
#fobj_out.write("\n\\newline\n")
tabdef = "||"
for i in range(self.num_cols_ext):
tabdef += "c|l||"
msg += "Externe Referenten\\\\\n\\\\\n" \
+ r"\scriptsize{\begin{tabular}{" \
+ tabdef + "}\n\\hline\n"
#fobj_out.write("Externe Referenten\\\\\n\\\\\n"
#+ r"\scriptsize{\begin{tabular}{"
#+ tabdef + "}\n\\hline\n")
for i in zip(self.fsr_extern, range(len(self.fsr_extern))):
if i[1] % self.num_cols_ext == 0:
msg += " "
#fobj_out.write(" ")
else:
msg += "&"
#fobj_out.write("&")
if "Sarah" in i[0]:
msg += r" &Sarah Anna Kova\v{c}"
#fobj_out.write(r" &Sarah Anna Kova\v{c}")
else:
msg += " &" +i[0]
#fobj_out.write(" &" + i[0])
msg += r"\end{tabular}}\normalsize\vspace{1em}"
msg += "\n\\newline\n"
#fobj_out.write(r"\end{tabular}}\normalsize\vspace{1em}")
#fobj_out.write("\n\\newline\n")
tabdef = "||"
for i in range(self.num_cols_ext):
tabdef += "c|l||"
msg += "Externe Referenten\\\\\n\\\\\n" \
+ r"\scriptsize{\begin{tabular}{" \
+ tabdef + "}\n\\hline\n"
#fobj_out.write("Externe Referenten\\\\\n\\\\\n"
#+ r"\scriptsize{\begin{tabular}{"
#+ tabdef + "}\n\\hline\n")
for i in zip(self.fsr_extern, range(len(self.fsr_extern))):
if i[1] % self.num_cols_ext == 0:
msg += " "
#fobj_out.write(" ")
else:
msg += "&"
#fobj_out.write("&")
if "Sarah" in i[0]:
msg += r" &Sarah Anna Kova\v{c}"
#fobj_out.write(r" &Sarah Anna Kova\v{c}")
else:
msg += " &" +i[0]
#fobj_out.write(" &" + i[0])
if i[1] % self.num_cols_ext == self.num_cols_ext - 1:
msg += "\\\\\\hline\n"
#fobj_out.write("\\\\\\hline\n")
else:
msg += "\n"
#fobj_out.write("\n")
msg += "\\end{tabular}}\\normalsize"
#fobj_out.write("\\end{tabular}}\\normalsize")
if i[1] % self.num_cols_ext == self.num_cols_ext - 1:
msg += "\\\\\\hline\n"
#fobj_out.write("\\\\\\hline\n")
else:
msg += "\n"
#fobj_out.write("\n")
msg += "\\end{tabular}}\\normalsize"
#fobj_out.write("\\end{tabular}}\\normalsize")
msg += f_foot
#fobj_out.write(f_foot)
......
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