improve tools for protocol handling

This commit is contained in:
2021-04-28 01:38:36 +02:00
parent 6f5325678f
commit 04a426a1f9
3 changed files with 20 additions and 6 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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]]