[Twisted-web] url.URL.fromRequest gives unexpected behaviour

Matt Goodall matt at pollenation.net
Wed Sep 8 05:35:48 MDT 2004


Hi,

URL.fromRequest() currently creates a URL for the path segments that
have been resolved so far. That means that creating a URL in locateChild
and a rend_* method gives you a different URL. That's unexpected.

I think we need more explicit ways of creating a URL to allow for
different usecases:


URL.fromString(aStr)
    create a URL from the string. this is already implemented

URL.fromRequestURI(aRequest)
    create a URL that matches the request exactly

URL.fromContext(aContext)
    create a URL for handled path segments. kind of like the
    url.here overlay but not so lazy.

A better name for fromContext might be fromLocation, fromSegment, etc.


We can deprecate URL.fromRequest but, until it's removed, make it call
fromContext.


Cheers, Matt

-- 
     __
    /  \__     Matt Goodall, Pollenation Internet Ltd
    \__/  \    w: http://www.pollenation.net
  __/  \__/    e: matt at pollenation.net
 /  \__/  \    t: +44 (0)113 2252500
 \__/  \__/
 /  \          Any views expressed are my own and do not necessarily
 \__/          reflect the views of my employer.




More information about the Twisted-web mailing list