class Root(controllers.Root):
def __init__(self):
self.customers=Customers()
class Customers(controllers.Root):
def lookup(self, custid):
'Some lookup function which will continue traversing the URL'
self.customer=Customer(custid)
class Customer(controllers.Root):
@turbogears.expose(html="ct.templates.customer")
def index(self, arg):
...
For now, I've overridden the __getattr__ method of the "Customers" class to do this, but it looks like TurboGears looks up the root.customers.cust_id about four times per request, so it seems a little inefficient. CherryPy's default method won't work either, because once you hit default, there's no more traversing. I think Quixote has something that handles this, but it's been a while since I looked at it. Any suggestions?
Categories: python, turbogears, web, cherrypy
4 comments: