I'm interested in making an API for a resource-tree, and in having the URLs qualified in part by file extension (xxx.json).
The docs mention discriminating based on XHR and mimetype, which I grok, but it's much easier to debug and view sent data by simply changing the URL. There is some chatter about this subject in a few places, notably here[1], but I have a more fundamental question, I think. I tried discriminating based on path_info regex pattern, and I just couldn't get it to work; at first I assumed my poor regex-foo, but now I'm thinking that it's simply not possible to add an extension and preserve traversal. For example: My current (working) paths are: /projects/ and /projects/GP008/ (I don't want the trailing slashes, but that's not important now) In this case, "projects" is a key corresponding to a mapping in my ZODB store, and "GP008" is a key within the mapping corresponding to a model object. So far, so good. I'd like to add /projects.json and /projects/GP008.json but of course those strings don't exist within the ZODB resource tree, so no matter what kind of regex-foo I administer, it won't match. So, does this mean simply that I cannot use traversal, and need to use explicit routes? I know that there are other options, like query strings, which I can code up... but there is something "nice" about the file extensions. Thanks! 1: http://stackoverflow.com/questions/4633320/is-there-a-better-way-to-switch-between-html-and-json-output-in-pyramid -- 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.