Would you be perturbed if I turned that around and asked you to take a look at http://static.repoze.org/bfgdocs/narr/traversal.html#a-traversal-example and tell me how I'd go about doing that sort of thing in CherryPy 3? In bfg, no user code runs during traversal except the __getitem__ of model objects. If each of your models inherits from Python "dict", the framework walks a graph of model objects without consulting any custom app code. The app code is only found as a result of finding a model and a "view name" and then translating that pair to a "view" (a "PageHandler" in CP terms, if I've got things right). The view is called at the end of traversal, not during traversal. I *think* the main difference here is that bfg does not assume that there is a graph of page handlers, instead it assumes there is a graph of model objects and finds a single page handler at the end (aka a view).
Here ya go
Posted byfumanchuat
2008-07-21 10:44 PM
http://www.aminus.org/rbre/python/zopepub
I'm not intimately familiar with the Model objects, I just mocked them up. I also didn't cover every corner case translating the URL's to the graph, but I'm sure you have tests for those already.
I'm not intimately familiar with the Model objects, I just mocked them up. I also didn't cover every corner case translating the URL's to the graph, but I'm sure you have tests for those already.
Replies to this comment