From 72e9e56422c8bbd9ea3f17878a2c17fe70beeb43 Mon Sep 17 00:00:00 2001 From: Ayman Bagabas Date: Sun, 6 Oct 2019 15:40:26 -0400 Subject: [PATCH] OpenSearch integration * Add a new endpoint /packages/opensearch that serves fedora_packages.xml * Add a new opensearch template * Add opensearch description link to chrome and search templates so the provider is visible in these two pages. --- fedoracommunity/controllers/root.py | 8 ++++++++ fedoracommunity/templates/chrome.mak | 3 +++ fedoracommunity/templates/opensearch.mak | 11 +++++++++++ fedoracommunity/templates/search.mak | 3 +++ 4 files changed, 25 insertions(+) create mode 100644 fedoracommunity/templates/opensearch.mak diff --git a/fedoracommunity/controllers/root.py b/fedoracommunity/controllers/root.py index b616b28e..26396860 100644 --- a/fedoracommunity/controllers/root.py +++ b/fedoracommunity/controllers/root.py @@ -74,6 +74,14 @@ def s(self, *args, **kwds): 'filters':{'search':search_str}} } + @expose('mako:fedoracommunity.templates.opensearch', content_type='text/xml') + def opensearch(self, *args, **kwds): + '''OpenSearch provider''' + if len(args) > 0 and args[0] == 'fedora_packages.xml': + return {'title': 'Fedora Packages'} + else: + redirect('/') + @expose('mako:fedoracommunity.widgets.templates.widget_loader') def _w(self, widget_name, *args, **kwds): '''generic widget controller - loads a widget from our widget list diff --git a/fedoracommunity/templates/chrome.mak b/fedoracommunity/templates/chrome.mak index 3a7cf25a..0ee480d6 100644 --- a/fedoracommunity/templates/chrome.mak +++ b/fedoracommunity/templates/chrome.mak @@ -16,6 +16,9 @@ type="image/vnd.microsoft.icon" rel="shortcut icon" /> +