Our application also uses a custom traverser to get namespace support. In our case, it turned out that we wanted all the additional traversing flexibility provided by `zope.traversing` so we simply used that in the traverser (this also made it easier to work with persistent registries via the subscribers in `zope.site`). This may be overkill for many use cases, but for anyone interested I've posted a hastily extracted copy at https://gist.github.com/jamadden/c11ef9cb6be8f6794261#file-traversal-py
Jason On Thursday, October 16, 2014 6:40:18 AM UTC-5, Thierry Florac wrote: > > Hi, > > That looks quite elegant! > But the namespace has sometimes been recorded into resources "__name__" > attribute, so is actually present into their URLs, and I'll probably have > to keep it for compatibility reasons... :-/ > I've already implemented a first version of a custom enhanced traverser > based on default Pyramid traverser and it seems to work quite well. > But your solution may be more elegant for future use cases... > > Best regards, > Thierry > > > 2014-10-16 7:42 GMT+02:00 Laurence Rowe <[email protected] <javascript:> > >: > >> >> >> On Wednesday, 15 October 2014 05:35:19 UTC-7, Thierry Florac wrote: >>> >>> Hi, >>> >>> Always on the road to adapting a Zope 3 application to Pyramid... >>> >>> Another of my problems is that Zope3 is handling "namespace" traversers; >>> for example, you can use URLs like "/++skin++MySkin/...", >>> "/++etc++site/...", or anything else by defining custom namespaces. >>> In my use case, the goal of such namespaces is generally to get a >>> resource throught an adapter. For example: "myimage/++display++500x500.png" >>> will use an adapter to get a thumbnail of 500x500 px of an image. >>> >>> My question is simple: what is the best way with Pyramid to handle such >>> case? Should I have to write a custom traverser? Use a router ?? >>> Maybe it looks like an hybrid URL, but where traversing should be used >>> before routing...? >>> >> >> If you are only using namespace traversers at the end of the url, >> consider replacing them with a view addressed like >> "myimage/@@display/500x500.png" >> >> In that view you can access the request.subpath == ['500x500.png'] >> >> Laurence >> >> -- >> You received this message because you are subscribed to the Google Groups >> "pylons-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/pylons-discuss. >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > http://www.imagesdusport.com -- http://www.ztfy.org > -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
