summaryrefslogtreecommitdiff
path: root/src/mailman/rest/templates.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman/rest/templates.py')
-rw-r--r--src/mailman/rest/templates.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mailman/rest/templates.py b/src/mailman/rest/templates.py
index bee21d7de..85c698f07 100644
--- a/src/mailman/rest/templates.py
+++ b/src/mailman/rest/templates.py
@@ -25,11 +25,8 @@ __all__ = [
]
-import os
+import falcon
-from restish import http, resource
-
-from mailman.config import config
from mailman.utilities.i18n import TemplateNotFoundError, find
@@ -41,7 +38,7 @@ EXTENSIONS = {
-class TemplateFinder(resource.Resource):
+class TemplateFinder:
"""Template finder resource."""
def __init__(self, mlist, template, language, content_type):
@@ -50,19 +47,20 @@ class TemplateFinder(resource.Resource):
self.language = language
self.content_type = content_type
- @resource.GET()
- def find_template(self, request):
+ def on_get(self, request, response):
# XXX We currently only support .txt and .html files.
extension = EXTENSIONS.get(self.content_type)
if extension is None:
- return http.not_found()
+ falcon.responders.path_not_found(request, response)
+ return
template = self.template + extension
fp = None
try:
try:
path, fp = find(template, self.mlist, self.language)
except TemplateNotFoundError:
- return http.not_found()
+ falcon.responders.path_not_found(request, response)
+ return
else:
return fp.read()
finally: