Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
protokollsystem
proto3
Commits
de4fe2d3
Commit
de4fe2d3
authored
Mar 01, 2017
by
Robin Sonnabend
Browse files
Fixed minor errors
parent
74811e3d
Changes
4
Hide whitespace changes
Inline
Side-by-side
calendarpush.py
View file @
de4fe2d3
...
...
@@ -13,6 +13,8 @@ class CalendarException(Exception):
class
Client
:
def
__init__
(
self
,
calendar
=
None
,
url
=
None
):
if
not
config
.
CALENDAR_ACTIVE
:
return
self
.
url
=
url
if
url
is
not
None
else
config
.
CALENDAR_URL
self
.
client
=
DAVClient
(
self
.
url
)
self
.
principal
=
None
...
...
@@ -20,10 +22,10 @@ class Client:
try
:
self
.
principal
=
self
.
client
.
principal
()
break
except
PropfindError
as
exc
:
print
(
exc
)
except
Exception
as
exc
:
print
(
"Got exception {} from caldav, retrying"
.
format
(
str
(
exc
))
)
if
self
.
principal
is
None
:
raise
CalendarException
(
"Got {}
PropfindE
rror
s
from the CalDAV server."
.
format
(
config
.
CALENDAR_MAX_REQUESTS
))
raise
CalendarException
(
"Got {}
CalDAV-e
rror from the CalDAV server."
.
format
(
config
.
CALENDAR_MAX_REQUESTS
))
if
calendar
is
not
None
:
self
.
calendar
=
self
.
get_calendar
(
calendar
)
else
:
...
...
@@ -38,9 +40,9 @@ class Client:
calendar
.
name
for
calendar
in
self
.
principal
.
calendars
()
]
except
PropfindError
as
exc
:
print
(
exc
)
raise
CalendarException
(
"Got {}
Propfind
Errors from the CalDAV server."
.
format
(
config
.
CALENDAR_MAX_REQUESTS
))
except
Exception
as
exc
:
print
(
"Got exception {} from caldav, retrying"
.
format
(
str
(
exc
))
)
raise
CalendarException
(
"Got {}
CalDAV
Errors from the CalDAV server."
.
format
(
config
.
CALENDAR_MAX_REQUESTS
))
def
get_calendar
(
self
,
calendar_name
):
...
...
config.py.example
View file @
de4fe2d3
...
...
@@ -61,6 +61,7 @@ WIKI_DOMAIN = "domain" # set to None if not necessary
CALENDAR_ACTIVE = True
CALENDAR_URL = "https://user:password@calendar.example.com/dav/"
CALENDAR_DEFAULT_DURATION = 3 # default meeting length in hours
CALENDAR_MAX_REQUESTS = 10
SESSION_PROTECTION = "strong" # do not change
...
...
@@ -122,6 +123,7 @@ DOCUMENTS_PATH = "documents"
# keywords indicating private protocol parts
PRIVATE_KEYWORDS = ["private", "internal", "privat", "intern"]
# list of bulletpoints to use in latex
LATEX_BULLETPOINTS = [
r"\textbullet",
r"\normalfont \bfseries \textendash",
...
...
server.py
View file @
de4fe2d3
...
...
@@ -49,7 +49,7 @@ def make_scheduler(app, config, function):
scheduler
.
start
()
scheduler
.
add_job
(
func
=
function
,
trigger
=
CronTrigger
(
hour
=
'*'
),
trigger
=
CronTrigger
(
hour
=
'*'
,
minute
=
30
),
id
=
"scheduler"
,
name
=
"Do an action regularly"
,
replace_existing
=
True
)
...
...
views/forms.py
View file @
de4fe2d3
...
...
@@ -25,12 +25,17 @@ def get_todostate_choices():
for
state
in
TodoState
]
def
get_calendar_choices
():
def
get_calendar_choices
(
protocoltype
=
None
):
calendars
=
CalendarClient
().
get_calendars
()
choices
=
[]
if
calendars
is
not
None
:
calendars
=
sorted
(
calendars
)
choices
=
list
(
zip
(
calendars
,
calendars
))
else
:
if
(
protocoltype
is
not
None
and
protocoltype
.
calendar
is
not
None
and
protocoltype
.
calendar
!=
""
):
choices
.
append
((
protocoltype
.
calendar
,
protocoltype
.
calendar
))
choices
.
insert
(
0
,
(
""
,
"Kein Kalender"
))
return
choices
...
...
@@ -77,7 +82,8 @@ class ProtocolTypeForm(FlaskForm):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
kwargs
)
self
.
calendar
.
choices
=
get_calendar_choices
()
protocoltype
=
kwargs
[
"obj"
]
if
"obj"
in
kwargs
else
None
self
.
calendar
.
choices
=
get_calendar_choices
(
protocoltype
=
protocoltype
)
self
.
printer
.
choices
=
get_printer_choices
()
group_choices
=
get_group_choices
()
self
.
modify_group
.
choices
=
group_choices
...
...
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