On Sat, Dec 27, 2008 at 12:33 AM, Tycon <adie...@gmail.com> wrote: > > It's always a bad idea to mix different types of urls without having > clearly defined separate prefixes for each. > Basically it's like having a global namespace, and even worse is that > you don't get ambiguity errors in case > of overlaps, you get one url superseding the other (this also applies > to static files hijacking a request with > the same url, which I guess both rails and pylons do by default, and > then for each request you actually have to check > if a file with that name exists and only if not then dispatch the > rails/pylons action ==> that is really bad programming, > performance wise and logic wise). > > it's like having the home directories not be under /home !!!! so if > you get a user named "etc" you r screw3d !!!
Pylons, or rather the StaticURLParser app in middleware.py, has the first chance at the URL and looks for a file in the public directory. If it can't find it, it returns an HTTP 404 and it then tries the Pylons application. (This is all done by the Cascade application in middleware.py.) Pylons could set up a prefix for all static files, but then people would complain they want another prefix or they need multiple directories. Plus, certain files like /robots.txt and /favicon.ico can't have a prefix. So Pylons punts and lets you put your static files under any URL. It's up to the programmer to choose one or a few easy-to-remember directories to put under it. I had an application in another framework (Quixote) where you had to set up static file handling manually. I put them all under a /static prefix. Then I had to set up two more handlers for robots and favicon, and then another for a directory of user-uploaded images. But I put all the help files under static because they were pregenerated HTML made by RoboHelp. When I converted the application to Pylons, I got rid of the /static prefix and was happier. -- Mike Orr <sluggos...@gmail.com> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---