def fromContext(klass, context): '''Create a URL object that represents the current URL in the traversal process.''' request = inevow.IRequest(context) request.prepath=[toBytes(i) for i in request.prepath] uri = toBytes(request.prePathURL()) if b'?' in toBytes(request.uri): uri += b'?' + toBytes(request.uri).split(b'?')[-1] return klass.fromString(unicode(uri))
def fromRequest(klass, request): """ Create a new L{URL} instance which is the same as the URL represented by C{request} except that it includes only the path segments which have already been processed. """ uri = request.prePathURL() if '?' in request.uri: uri += '?' + request.uri.split('?')[-1] return klass.fromString(uri)