Replace ctx references with req references

This commit is contained in:
Sajith Sasidharan 2020-06-15 15:17:43 -04:00
parent 1ee756c8df
commit de99912641

View File

@ -203,18 +203,17 @@ class ResultsBase(object):
assert isinstance(s, (list, tuple)) assert isinstance(s, (list, tuple))
return [html.escape(w) for w in s] return [html.escape(w) for w in s]
def want_json(self, ctx): def want_json(self, req):
output = get_arg(inevow.IRequest(ctx), "output", "").lower() output = get_arg(req, "output", "").lower()
if output.lower() == "json": if output.lower() == "json":
return True return True
return False return False
def _render_si_link(self, ctx, storage_index): def _render_si_link(self, req, storage_index):
si_s = base32.b2a(storage_index) si_s = base32.b2a(storage_index)
req = inevow.IRequest(ctx)
ophandle = req.prepath[-1] ophandle = req.prepath[-1]
target = "%s/operations/%s/%s" % (get_root(ctx), ophandle, si_s) target = "%s/operations/%s/%s" % (get_root(req), ophandle, si_s)
output = get_arg(ctx, "output") output = get_arg(req, "output")
if output: if output:
target = target + "?output=%s" % output target = target + "?output=%s" % output
return tags.a(si_s, href=target) return tags.a(si_s, href=target)