everest.traversal

Custom resource object tree traverser.

class everest.traversal.SuffixResourceTraverser(root)[source]

Bases: pyramid.traversal.ResourceTreeTraverser

A custom model traverser that allows us to specify the representation for resources with a suffix as in http://everest/racks.csv.

Rather than to reproduce the functionality of the __call__ method, we check if base part of the current view name (racks in the example) can be retrieved as a child resource from the context. If yes, we set the context to the resource and the view name to the extension part of the current view name (csv in the example); if no, nothing is changed.

Project Versions

Next topic

everest.url

This Page