Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
proto3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
protokollsystem
proto3
Commits
de4fe2d3
Commit
de4fe2d3
authored
8 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Fixed minor errors
parent
74811e3d
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
calendarpush.py
+8
-6
8 additions, 6 deletions
calendarpush.py
config.py.example
+2
-0
2 additions, 0 deletions
config.py.example
server.py
+1
-1
1 addition, 1 deletion
server.py
views/forms.py
+8
-2
8 additions, 2 deletions
views/forms.py
with
19 additions
and
9 deletions
calendarpush.py
+
8
−
6
View file @
de4fe2d3
...
@@ -13,6 +13,8 @@ class CalendarException(Exception):
...
@@ -13,6 +13,8 @@ class CalendarException(Exception):
class
Client
:
class
Client
:
def
__init__
(
self
,
calendar
=
None
,
url
=
None
):
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
.
url
=
url
if
url
is
not
None
else
config
.
CALENDAR_URL
self
.
client
=
DAVClient
(
self
.
url
)
self
.
client
=
DAVClient
(
self
.
url
)
self
.
principal
=
None
self
.
principal
=
None
...
@@ -20,10 +22,10 @@ class Client:
...
@@ -20,10 +22,10 @@ class Client:
try
:
try
:
self
.
principal
=
self
.
client
.
principal
()
self
.
principal
=
self
.
client
.
principal
()
break
break
except
PropfindError
as
exc
:
except
Exception
as
exc
:
print
(
exc
)
print
(
"
Got exception {} from caldav, retrying
"
.
format
(
str
(
exc
))
)
if
self
.
principal
is
None
:
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
:
if
calendar
is
not
None
:
self
.
calendar
=
self
.
get_calendar
(
calendar
)
self
.
calendar
=
self
.
get_calendar
(
calendar
)
else
:
else
:
...
@@ -38,9 +40,9 @@ class Client:
...
@@ -38,9 +40,9 @@ class Client:
calendar
.
name
calendar
.
name
for
calendar
in
self
.
principal
.
calendars
()
for
calendar
in
self
.
principal
.
calendars
()
]
]
except
PropfindError
as
exc
:
except
Exception
as
exc
:
print
(
exc
)
print
(
"
Got exception {} from caldav, retrying
"
.
format
(
str
(
exc
))
)
raise
CalendarException
(
"
Got {}
Propfind
Errors from the CalDAV server.
"
.
format
(
config
.
CALENDAR_MAX_REQUESTS
))
raise
CalendarException
(
"
Got {}
CalDAV
Errors from the CalDAV server.
"
.
format
(
config
.
CALENDAR_MAX_REQUESTS
))
def
get_calendar
(
self
,
calendar_name
):
def
get_calendar
(
self
,
calendar_name
):
...
...
This diff is collapsed.
Click to expand it.
config.py.example
+
2
−
0
View file @
de4fe2d3
...
@@ -61,6 +61,7 @@ WIKI_DOMAIN = "domain" # set to None if not necessary
...
@@ -61,6 +61,7 @@ WIKI_DOMAIN = "domain" # set to None if not necessary
CALENDAR_ACTIVE = True
CALENDAR_ACTIVE = True
CALENDAR_URL = "https://user:password@calendar.example.com/dav/"
CALENDAR_URL = "https://user:password@calendar.example.com/dav/"
CALENDAR_DEFAULT_DURATION = 3 # default meeting length in hours
CALENDAR_DEFAULT_DURATION = 3 # default meeting length in hours
CALENDAR_MAX_REQUESTS = 10
SESSION_PROTECTION = "strong" # do not change
SESSION_PROTECTION = "strong" # do not change
...
@@ -122,6 +123,7 @@ DOCUMENTS_PATH = "documents"
...
@@ -122,6 +123,7 @@ DOCUMENTS_PATH = "documents"
# keywords indicating private protocol parts
# keywords indicating private protocol parts
PRIVATE_KEYWORDS = ["private", "internal", "privat", "intern"]
PRIVATE_KEYWORDS = ["private", "internal", "privat", "intern"]
# list of bulletpoints to use in latex
LATEX_BULLETPOINTS = [
LATEX_BULLETPOINTS = [
r"\textbullet",
r"\textbullet",
r"\normalfont \bfseries \textendash",
r"\normalfont \bfseries \textendash",
...
...
This diff is collapsed.
Click to expand it.
server.py
+
1
−
1
View file @
de4fe2d3
...
@@ -49,7 +49,7 @@ def make_scheduler(app, config, function):
...
@@ -49,7 +49,7 @@ def make_scheduler(app, config, function):
scheduler
.
start
()
scheduler
.
start
()
scheduler
.
add_job
(
scheduler
.
add_job
(
func
=
function
,
func
=
function
,
trigger
=
CronTrigger
(
hour
=
'
*
'
),
trigger
=
CronTrigger
(
hour
=
'
*
'
,
minute
=
30
),
id
=
"
scheduler
"
,
id
=
"
scheduler
"
,
name
=
"
Do an action regularly
"
,
name
=
"
Do an action regularly
"
,
replace_existing
=
True
)
replace_existing
=
True
)
...
...
This diff is collapsed.
Click to expand it.
views/forms.py
+
8
−
2
View file @
de4fe2d3
...
@@ -25,12 +25,17 @@ def get_todostate_choices():
...
@@ -25,12 +25,17 @@ def get_todostate_choices():
for
state
in
TodoState
for
state
in
TodoState
]
]
def
get_calendar_choices
():
def
get_calendar_choices
(
protocoltype
=
None
):
calendars
=
CalendarClient
().
get_calendars
()
calendars
=
CalendarClient
().
get_calendars
()
choices
=
[]
choices
=
[]
if
calendars
is
not
None
:
if
calendars
is
not
None
:
calendars
=
sorted
(
calendars
)
calendars
=
sorted
(
calendars
)
choices
=
list
(
zip
(
calendars
,
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
"
))
choices
.
insert
(
0
,
(
""
,
"
Kein Kalender
"
))
return
choices
return
choices
...
@@ -77,7 +82,8 @@ class ProtocolTypeForm(FlaskForm):
...
@@ -77,7 +82,8 @@ class ProtocolTypeForm(FlaskForm):
def
__init__
(
self
,
**
kwargs
):
def
__init__
(
self
,
**
kwargs
):
super
().
__init__
(
**
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
()
self
.
printer
.
choices
=
get_printer_choices
()
group_choices
=
get_group_choices
()
group_choices
=
get_group_choices
()
self
.
modify_group
.
choices
=
group_choices
self
.
modify_group
.
choices
=
group_choices
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment