mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 13:33:09 +00:00
Hotfix for nevow#106
This commit is contained in:
parent
78e458328e
commit
336e69c270
31
src/allmydata/web/_nevow_106.py
Normal file
31
src/allmydata/web/_nevow_106.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
"""
|
||||||
|
Implement a work-around for <https://github.com/twisted/nevow/issues/106>.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import (
|
||||||
|
print_function,
|
||||||
|
unicode_literals,
|
||||||
|
absolute_import,
|
||||||
|
division,
|
||||||
|
)
|
||||||
|
|
||||||
|
from nevow import inevow
|
||||||
|
from twisted.internet import defer
|
||||||
|
|
||||||
|
def renderHTTP(self, ctx):
|
||||||
|
request = inevow.IRequest(ctx)
|
||||||
|
if self.real_prepath_len is not None:
|
||||||
|
request.postpath = request.prepath + request.postpath
|
||||||
|
request.prepath = request.postpath[:self.real_prepath_len]
|
||||||
|
del request.postpath[:self.real_prepath_len]
|
||||||
|
result = defer.maybeDeferred(self.original.render, request).addCallback(
|
||||||
|
self._handle_NOT_DONE_YET, request)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def patch():
|
||||||
|
"""
|
||||||
|
Monkey-patch the proposed fix into place.
|
||||||
|
"""
|
||||||
|
from nevow.appserver import OldResourceAdapter
|
||||||
|
OldResourceAdapter.renderHTTP = renderHTTP
|
@ -54,6 +54,11 @@ from .logs import (
|
|||||||
create_log_resources,
|
create_log_resources,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Hotfix work-around https://github.com/twisted/nevow/issues/106
|
||||||
|
from . import _nevow_106
|
||||||
|
_nevow_106.patch()
|
||||||
|
del _nevow_106
|
||||||
|
|
||||||
SCHEME = b"tahoe-lafs"
|
SCHEME = b"tahoe-lafs"
|
||||||
|
|
||||||
class IToken(ICredentials):
|
class IToken(ICredentials):
|
||||||
|
Loading…
Reference in New Issue
Block a user