twisted / nevow

Web Application Construction Kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deprecation warning in appserver.NevowRequest

warner opened this issue · comments

When I enable deprecation warnings in my tests (Tahoe-LAFS, using Nevow-0.11.1 and Twisted > 13.2), I get a warning from nevow:

.../Nevow-0.11.1-py2.7.egg/nevow/appserver.py:129: DeprecationWarning: twisted.web.http.Request.received_headers was deprecated in Twisted 13.2.0: Please use twisted.web.http.Request.requestHeaders instead.

It looks like nevow.appserver.NevowRequest.process is doing:

    self.fields = cgi.FieldStorage(self.content, self.received_headers,
                                   environ={'REQUEST_METHOD': 'POST'})

and Twisted doesn't like that anymore. received_headers provided a dict, which was lossy but convenient for cgi.FieldStorage. requestHeaders is not a dict, and will probably need some new code to transform it into a form that cgi.FieldStorage likes.

This is very important now since Twisted 16.0.0 removed the deprecated attribute, so Nevow will be broken once that is out.

Okay, nevermind, the breakage was fixed in c1ba6f1, just need to do another release.

Tahoe's unit tests (along with all actual functionality) will break if Twisted-16.0.0 comes out before the new Nevow release.. is there anything we can do to help the Nevow release along? I think 16.0.0 is in the pipeline, so the clock is ticking :)

refs: https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2732

Yeah, I have a bunch of stuff that'll break too :) I'm going to try get a release out today or tomorrow. (16.0.0 prerelase is out, but I think we've got a few days at least before a final).

There are probably backwards-compatibility issues I'm not aware of, but am I correct in thinking that we'll still get self-inflicted deprecation warning with c1ba6f1 and the new release? It looks like NevowRequest.process() still uses self.received_headers, which is implemented as a (Nevow-provided, Nevow-deprecated) property that wraps a (Nevow-provided) _DictHeaders around the modern twisted.web self.requestHeaders.

That's not as severe as breaking entirely, but it sounds like we should still expect to see DeprecationWarnings in our test run. Except that now it will be Nevow complaining about it's own code, rather than Twisted complaining about Nevow. Sound about right?

Yes, that's correct; and apparently this code path isn't tested? At least, I didn't see the warning during a test run on #69. I'll try to fix it in another branch, though. Hopefully then Nevow shouldn't be tripping its own warnings or Twisted's.

@warner Just released 0.13.0!