aboutsummaryrefslogtreecommitdiff
path: root/coupons.py
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-09-26 14:24:11 -0400
committerB. Stack <bgstack15@gmail.com>2022-09-26 14:24:11 -0400
commit0843f1ae31ef7fbf555b6683f20967450fe93ef1 (patch)
treec4514eadc8c761a9c89b7771c762c683c5254d96 /coupons.py
parentfix makefile install httpd conf (diff)
downloadcoupons-0843f1ae31ef7fbf555b6683f20967450fe93ef1.tar.gz
coupons-0843f1ae31ef7fbf555b6683f20967450fe93ef1.tar.bz2
coupons-0843f1ae31ef7fbf555b6683f20967450fe93ef1.zip
support nested items?
Diffstat (limited to 'coupons.py')
-rwxr-xr-xcoupons.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/coupons.py b/coupons.py
index 0356bfb..7ce2411 100755
--- a/coupons.py
+++ b/coupons.py
@@ -196,7 +196,16 @@ def parse_coupons(inputobject, searchstring = None):
rcat = c["name"]
#response[rgroup][rcat] = []
for i in c["items"]:
- text = i["html"]
+ print(f"item = {i}")
+ try:
+ text = i["html"]
+ except:
+ text = i["name"]
+ add_text = ""
+ for h in i["items"] if "items" in i else []:
+ add_text += "<li>" + str(h["html"] if "html" in h else "") + str(h["notes"] if "notes" in h else "") + "</li>"
+ if "" != add_text:
+ text += "<ul>" + add_text + "</ul>"
if "notes" in i and i["notes"] != "":
text = text + " <small>" + i["notes"] + "</small>"
#if searchstring in text.lower():
bgstack15