Once nevow is removed from web/common.py, we can simplify
renderJSON(), like so:
def renderJSON():
req = Request()
req.args = {"t": ["json"]}
req.fields = {}
return resource.render(req)
But for now we have to live with an inner class that implements the
nevow.inevow.IRequest interface.
Using twisted.web.server.Request causes test_new_style_classes to
fail like so:
Traceback (most recent call last):
Failure: testtools.testresult.real._StringException: Traceback (most recent call last):
File ".tox/coverage/lib/python2.7/site-packages/allmydata/test/test_python2_regressions.py", line 69, in test_new_style_classes
"Expected to find no classic classes.",
File ".tox/coverage/lib/python2.7/site-packages/testtools/testcase.py", line 502, in assertThat
raise mismatch_error
testtools.matchers._impl.MismatchError: !=:
reference = set([])
actual = set([<class allmydata.test.test_storage.JSONRequest at 0x7fd938040bb0>])
: Expected to find no classic classes.
Seems that `DummyRequest` is an acceptable new style class.
Use twisted.web.server.Request instead, with a DummyChannel.
There's still one line of inevitable nevow now, because of code in
web/common.py; but that should be easily replaceable once we switch
that over.
When no storage is up, `storage_running()` renderer will return a big
honking `no storage server running` message, and no further renderers
will be invoked. Therefore the extra defense is probably not
required.
(I tested this hypothesis. The extra defense is not required, unless
there's something I have not seen.)
Related to ticket:3247
test_storage.py wants a `StorageStatus::renderSynchronously()` method
and a `StorageStatus::renderHTTP()` method. Let us begin with the
goofy first-cut.
Both these methods are not only wrong, but they will also not please
the test suite. However error messages produced in CI can be shared,
and that way I can hopefully get unstuck.
Related to ticket:3247. Nevow usage has been removed, and generated
page looks the same as its former self, but tests are failing because
test_storage.py assumes that we're using nevow.