diff options
author | B. Stack <bgstack15@gmail.com> | 2022-09-26 14:24:11 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-09-26 14:24:11 -0400 |
commit | 0843f1ae31ef7fbf555b6683f20967450fe93ef1 (patch) | |
tree | c4514eadc8c761a9c89b7771c762c683c5254d96 /coupons.py | |
parent | fix makefile install httpd conf (diff) | |
download | coupons-0843f1ae31ef7fbf555b6683f20967450fe93ef1.tar.gz coupons-0843f1ae31ef7fbf555b6683f20967450fe93ef1.tar.bz2 coupons-0843f1ae31ef7fbf555b6683f20967450fe93ef1.zip |
support nested items?
Diffstat (limited to 'coupons.py')
-rwxr-xr-x | coupons.py | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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(): |