mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-22 02:16:42 +00:00
De-Nevow `get_root
`
This commit is contained in:
parent
743ead71a4
commit
304a9880e6
@ -47,7 +47,6 @@ from twisted.internet.defer import (
|
|||||||
from twisted.web.resource import (
|
from twisted.web.resource import (
|
||||||
IResource,
|
IResource,
|
||||||
)
|
)
|
||||||
from twisted.web.iweb import IRequest as ITwistedRequest
|
|
||||||
if PY2:
|
if PY2:
|
||||||
from nevow.appserver import DefaultExceptionHandler
|
from nevow.appserver import DefaultExceptionHandler
|
||||||
from nevow.inevow import IRequest as INevowRequest
|
from nevow.inevow import IRequest as INevowRequest
|
||||||
@ -161,11 +160,7 @@ def parse_offset_arg(offset):
|
|||||||
return offset
|
return offset
|
||||||
|
|
||||||
|
|
||||||
def get_root(ctx_or_req):
|
def get_root(req):
|
||||||
if PY2:
|
|
||||||
req = INevowRequest(ctx_or_req)
|
|
||||||
else:
|
|
||||||
req = ITwistedRequest(ctx_or_req)
|
|
||||||
depth = len(req.prepath) + len(req.postpath)
|
depth = len(req.prepath) + len(req.postpath)
|
||||||
link = "/".join([".."] * depth)
|
link = "/".join([".."] * depth)
|
||||||
return link
|
return link
|
||||||
|
Loading…
x
Reference in New Issue
Block a user