Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Fachschaftsrat Physik TUKL
Protokoll
protokoll_skript
Commits
c32351a3
Commit
c32351a3
authored
Jul 27, 2018
by
Lorenz Steinert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using mock funktions so changed esme.py back
parent
2bd98c8f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
23 deletions
+14
-23
bin/module/esme.py
bin/module/esme.py
+14
-23
No files found.
bin/module/esme.py
View file @
c32351a3
...
...
@@ -38,14 +38,11 @@ class FsrLdap:
connect_timeout
=
timeout
)
self
.
base
=
base
def
get_protokollant_ldap
(
self
,
config
,
testing
=
False
):
def
get_protokollant_ldap
(
self
,
config
):
"""search the LDAP for the current user"""
print
(
"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
,
...
...
@@ -61,14 +58,11 @@ class FsrLdap:
print
(
"Couldn't Connect to ldap.
\n
Using fallback default.
\n
"
)
return
get_protokollant
(
config
)
def
get_fsr_ldap
(
self
,
share_dir
=
None
,
gen_fallback
=
False
,
testing
=
False
):
def
get_fsr_ldap
(
self
,
share_dir
=
None
,
gen_fallback
=
False
):
"""get fsr from LDAP"""
print
(
"Fetching FSR from LDAP ..."
)
try
:
if
testing
:
conn
=
ldap
.
Connection
(
self
.
server
,
client_strategy
=
ldap
.
MOCK_SYNC
)
else
:
conn
=
ldap
.
Connection
(
self
.
server
)
conn
=
ldap
.
Connection
(
self
.
server
)
conn
.
bind
()
fil
=
'(cn=intern)'
fsr
=
[]
...
...
@@ -95,14 +89,11 @@ class FsrLdap:
if
not
gen_fallback
:
return
get_fallback_fsr
(
share_dir
)
def
get_fsr_extern_ldap
(
self
,
share_dir
=
None
,
gen_fallback
=
False
,
testing
=
False
):
def
get_fsr_extern_ldap
(
self
,
share_dir
=
None
,
gen_fallback
=
False
):
"""get the EFSR from LDAP"""
print
(
"Fetching EFSR from LDAP ..."
)
try
:
if
testing
:
conn
=
ldap
.
Connection
(
self
.
server
,
client_strategy
=
ldap
.
MOCK_SYNC
)
else
:
conn
=
ldap
.
Connection
(
self
.
server
)
conn
=
ldap
.
Connection
(
self
.
server
)
conn
.
bind
()
fil
=
'(cn=extern)'
fsr_extern
=
[]
...
...
@@ -158,29 +149,29 @@ def get_fallback_fsr_extern(share_dir):
return
[]
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
=
get
input
(
"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
=
get
input
(
"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'
)
...
...
@@ -194,7 +185,7 @@ def get_date(test=False, getinput=input):
day
=
"0"
+
day
date
=
(
day
+
'.'
+
mon
+
'.'
+
year
,
year
,
mon
,
day
)
dtmp
=
get
input
(
"Datum ["
+
date
[
0
]
+
"]: "
)
dtmp
=
input
(
"Datum ["
+
date
[
0
]
+
"]: "
)
if
dtmp
!=
""
:
day
,
mon
,
year
=
dtmp
.
split
(
'.'
)
if
len
(
mon
)
<
2
:
...
...
@@ -207,9 +198,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
=
get
input
(
"Editor ["
+
editor
+
"]: "
)
etmp
=
input
(
"Editor ["
+
editor
+
"]: "
)
if
etmp
!=
""
:
return
etmp
return
editor
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment