Commit 18540d46 authored by Karel Koci's avatar Karel Koci 🤘

lists: update API to support additional fields.

This adds support for URL and support marking. The idea is that we can
have not-translated URL to documentation and also we can separate now
officially supported pkglists from those not supported.
parent e1ad18d8
...@@ -39,11 +39,11 @@ def pkglists(lang=None): ...@@ -39,11 +39,11 @@ def pkglists(lang=None):
Return pkglists are in dictionary where key is name of pkglist and value is Return pkglists are in dictionary where key is name of pkglist and value is
another dictionary with following content: another dictionary with following content:
"enabled": This is boolean value containing info if pkglist is enabled. "enabled": This is boolean value containing info if pkglist is enabled.
"hidden": This is boolean value specifying if pkglist is pkg visible. "hidden": This is boolean value specifying if pkglist is visible.
"title": This is title text describing pkglist (human readable name). This "official": This is boolean value specifying if pkglist is supported.
field can be None if "hidden" field is set to True. "title": This is title text describing pkglist (human readable name).
"message": This is human readable description of given pkglist. This can be "message": This is human readable description of given pkglist.
None if "hidden" is set to True. "url": Optional URL to documentation. This can be None if not provided.
""" """
result = dict() result = dict()
...@@ -56,13 +56,14 @@ def pkglists(lang=None): ...@@ -56,13 +56,14 @@ def pkglists(lang=None):
with open(PKGLISTS_FILE, 'r') as file: with open(PKGLISTS_FILE, 'r') as file:
ldul = json.load(file) ldul = json.load(file)
for name, lst in ldul.items(): for name, lst in ldul.items():
visible = lst['visible']
result[name] = { result[name] = {
"title": trans.gettext(lst['title']) if 'title' in lst else None,
"message": trans.gettext(lst['description']) if 'description' in lst else None,
"enabled": False, "enabled": False,
"hidden": not visible "title": trans.gettext(lst['title']),
} "message": trans.gettext(lst['description']),
"hidden": not lst.get('visible', True),
"official": lst.get('official', False),
"url": lst.get('url'),
}
with Uci() as uci: with Uci() as uci:
try: try:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment