Commit cd07fe93 authored by Lorenz Steinert's avatar Lorenz Steinert

Merge branch 'master' of gitlab.rlp.net:fsr_physik_tu_kl/protokoll/protokoll_skript

parents 92a512cf 3aa97008
......@@ -65,14 +65,11 @@ class FsrLdap:
self.base = base
self.share_dir = share_dir
def get_protokollant_ldap(self, config, testing=False):
def get_protokollant_ldap(self, config):
"""search the LDAP for the current user"""
logging.info("Fetching Protokollant from LDAP ...")
try:
if testing:
conn = ldap.Connection(self.server, ldap.MOCK_SYNC)
else:
conn = ldap.Connection(self.server)
conn = ldap.Connection(self.server)
conn.bind()
fil = "(uid="+current_user()+")"
if conn.search('ou=people,' + self.base, fil,
......@@ -193,29 +190,29 @@ class FsrLdap:
return resort_fsr(fsr)
def get_sprecher(config=None, getinput=input):
def get_sprecher(config=None):
"""get sprecher from user input or config"""
sprecher = ''
if config:
sprecher = config['PROTOKOLL']['Sprecher']
stmp = getinput("Sprecher ["+sprecher+"]: ")
stmp = input("Sprecher ["+sprecher+"]: ")
if stmp != "":
return stmp
return sprecher
def get_protokollant(config=None, getinput=input):
def get_protokollant(config=None):
"""get protokollant from user input or config"""
protokollant = ''
if config:
protokollant = config['PROTOKOLL']['Protokollant']
ptmp = getinput("Protokollant ["+protokollant+"]: ")
ptmp = input("Protokollant ["+protokollant+"]: ")
if ptmp != "":
return ptmp
return protokollant
def get_date(test=False, getinput=input):
def get_date(test=False):
"""get current date then ask user"""
if test:
date = ('01.01.2000', '2000', '01', '01')
......@@ -229,7 +226,7 @@ def get_date(test=False, getinput=input):
day = "0"+day
date = (day + '.' + mon + '.' + year, year, mon, day)
dtmp = getinput("Datum ["+date[0]+"]: ")
dtmp = input("Datum ["+date[0]+"]: ")
if dtmp != "":
day, mon, year = dtmp.split('.')
if len(mon) < 2:
......@@ -242,9 +239,9 @@ def get_date(test=False, getinput=input):
return date
def get_editor(editor, getinput=input):
def get_editor(editor):
"""get the editor to use from user input"""
etmp = getinput("Editor ["+editor+"]: ")
etmp = input("Editor ["+editor+"]: ")
if etmp != "":
return etmp
return editor
......
This diff is collapsed.
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