On Sat, Jan 30, 2010 at 2:11 PM, Jonathan Vanasco <[email protected]> wrote: > > > On Jan 30, 2:06 am, Mike Orr <[email protected]> wrote: > >> I consider such slash manipulation to be highly unorthodox and >> undesirable, but that's how you can do it if you want to. > > Thanks Mike! > > I find the slash manipulation to be standard. > > The default behavior for static webservers has been: > > filesystem: > /folder/index.html > > urls: > /folder/index.html > /folder/ > /folder ( redirects to /folder/ )
By slash manipulation I meant capturing the slash in a variable and stripping it out in a route function. What you have here is the tradition of a static server, where "/folder/" is shorthand for "/folder/index.html", and "/folder" redirects to it so that any relative links in the document will work. You can do this with Pylons, but it seems more common to treat trailing "/" like ".html" -- unnecessary cruft from the world of static servers. The corollary is that Pylons pages normally don't have relative URLs -- they generally have root URLs generated by url(). If you want to use relative URLs, you may have to go with the trailing slash syntax. One reason the trailing slash isn't common is that it can be hard to tell what's a "directory" in a dynamic application. The page may be perfectly fine as a standalone page (file-like), but also have an optional something below it. For instance, "/about" and "/about/subpage1". And a naive user is going to type the URL without the trailing slash anyway because he may not know there's something below it. And maybe a later version of the site will change its mind about whether the URL is a "file" (with no children) or a "directory" (with children). The main thing to avoid is serving the same content for "/folder" and "/folder/" without a redirect, because that means there's two URLs for the same item. So proxies will cache both URLs separately, and different users may bookmark one or the other, and if you ever reorganize your URL scheme you'll have to put redirects for both. -- Mike Orr <[email protected]> -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
