
On Mon, 2005-02-28 at 14:15 -0500, Mike C. Fletcher wrote:
Stephen Waterbury wrote: ...
Critiques or razberries welcomed, as long as they're constructive razberries! :)
This is extremely illuminating. The key approach/idea that I was missing is this:
You can create a root web.resource.Resource() and add a child "" that handles all URLs not otherwise matched by a known child.
This is incorrect. A child of "" matches the empty path segment. Most of the time this is used to handle a URL that ends in a "/" but an empty segment is also legitimate in the middle of a URL. For instance, the URL "/foo/bar/" translates to segments of ("foo", "bar", ""); "/" translates to ("",); "/foo//bar" translates to ("foo", "", "bar"). In Nevow, you handle unmatched children by overriding locateChild(self, ctx, segments) or, in the case of a rend.Page subclass, providing a childFactory(self, ctx, name) method. - Matt
This "" child handles the common web-browser case, basically anything not going to your "special" directories. This child is the protected Nevow portal that we all know and love; on attempting to walk into it all the Nevow machinery should trigger.
Now you register your Basic-Auth-protected XMLRPC/SOAP portals as parallel children of the Nevow portal, "RPC" and "SOAP". These are again, portals, so they do their own credential checking, thus don't *necessarily* have to use the same cred mechanism, but can if they want to.
This doesn't actually do what I was *trying* to do, which was to make it possible to log into the main site using Basic auth *or* the Nevow web forms, but it handles what we actually need to do perfectly, so I can just stop trying to do what I was trying to do :) . I'm about to sit down to implement this approach for our system.
Much obliged, Mike
________________________________________________ Mike C. Fletcher Designer, VR Plumber, Coder http://www.vrplumber.com http://blog.vrplumber.com PyCon is coming...
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python