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