improve tools for protocol handling
This commit is contained in:
17
generate.py
17
generate.py
@@ -59,6 +59,9 @@ class Top:
|
|||||||
else:
|
else:
|
||||||
raise ValueError("One of title or message is needed")
|
raise ValueError("One of title or message is needed")
|
||||||
|
|
||||||
|
if self.body is None:
|
||||||
|
self.body = ""
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<TOP "+self.title+">"
|
return "<TOP "+self.title+">"
|
||||||
|
|
||||||
@@ -92,12 +95,18 @@ def weekday(indate):
|
|||||||
return WEEKDAYS[indate.weekday()]
|
return WEEKDAYS[indate.weekday()]
|
||||||
|
|
||||||
def prototop(top):
|
def prototop(top):
|
||||||
|
result = ""
|
||||||
|
|
||||||
if "protostub" in dir(top) and top.protostub:
|
if "protostub" in dir(top) and top.protostub:
|
||||||
return j2env.from_string(top.protostub).render(context, top=top)
|
result = j2env.from_string(top.protostub).render(context, top=top)
|
||||||
elif top.body:
|
elif top.body:
|
||||||
return j2env.from_string(top.body).render(context)
|
result = j2env.from_string(top.body).render(context)
|
||||||
else:
|
|
||||||
return None
|
for search,replace in config["protoreplace"].items():
|
||||||
|
result = result.replace(search, replace)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
def conf2top(top):
|
def conf2top(top):
|
||||||
sender = None
|
sender = None
|
||||||
|
|||||||
@@ -1,5 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo Reading old protocols
|
||||||
./read_db.sh
|
./read_db.sh
|
||||||
|
echo Getting E-Mail
|
||||||
|
./read_topmails.py
|
||||||
./read_ubmails.py
|
./read_ubmails.py
|
||||||
|
echo Generating
|
||||||
|
|
||||||
./generate.py --proto > ~/fsmi/protokolle/$(date +%Y-%m-%d)
|
./generate.py --proto > ~/fsmi/protokolle/$(date +%Y-%m-%d)
|
||||||
|
|
||||||
|
|||||||
@@ -16,9 +16,8 @@
|
|||||||
|
|
||||||
{% for top in to %}
|
{% for top in to %}
|
||||||
= {{top.title}} =
|
= {{top.title}} =
|
||||||
{%if top.sender%}Eingereicht von: {{top.sender}}
|
|
||||||
|
|
||||||
{%endif%}{{top|prototop}}
|
{{top|prototop}}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
[[Kategorie:Protokoll]]
|
[[Kategorie:Protokoll]]
|
||||||
|
|||||||
Reference in New Issue
Block a user