diff options
author | Mattori Birnbaum <mattori.birnbaum@gmail.com> | 2021-05-10 19:54:54 +0900 |
---|---|---|
committer | Christian Geier <geier@lostpackets.de> | 2023-10-28 16:40:56 +0200 |
commit | 6d0412d8339ddaf5d4a34785e8c89c8abdb95c5e (patch) | |
tree | 096c0e536bfbf07b8392ee2ffd10b6d9a0677f07 | |
parent | 07c96f617e7ab1f90b90d96c2b470ca499b3fce4 (diff) |
add list of content attributes
-rw-r--r-- | khal/utils.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/khal/utils.py b/khal/utils.py index 65bb3000..f875f8d2 100644 --- a/khal/utils.py +++ b/khal/utils.py @@ -213,6 +213,16 @@ def human_formatter(format_string, width=None, colors=True): return fmt +CONTENT_ATTRIBUTES = ['start', 'start-long', 'start-date', 'start-date-long', + 'start-time', 'end', 'end-long', 'end-date', 'end-date-long', 'end-time', + 'duration', 'start-full', 'start-long-full', 'start-date-full', 'start-date-long-full', + 'start-time-full', 'end-full', 'end-long-full', 'end-date-full', 'end-date-long-full', 'end-time-full', + 'duration-full', 'start-style', 'end-style', 'to-style', 'start-end-time-style', + 'end-necessary', 'end-necessary-long', 'repeat-symbol', 'repeat-pattern', 'title', + 'organizer', 'description', 'location', 'all-day', 'categories', 'uid', 'url', 'calendar', 'calendar-color', + 'status', 'cancelled'] + + def json_formatter(fields): """Create a formatter that formats events in JSON.""" def fmt(rows): @@ -222,7 +232,7 @@ def json_formatter(fields): filtered = [] for row in rows: - f = dict(filter(lambda e: e[0] in fields, row.items())) + f = dict(filter(lambda e: e[0] in fields and e[0] in CONTENT_ATTRIBUTES, row.items())) if f.get('repeat-symbol', '') != '': f["repeat-symbol"] = f["repeat-symbol"].strip() |