def __call__(self):
        route = self.context.route
        wrapped = getObject(route, self.context, self.request)

        if IWrappedBrainsContext.providedBy(wrapped):
            view = wrapped.restrictedTraverse('folder_summary_view')
        elif IWrappedObjectContext.providedBy(wrapped):
            layout = wrapped.obj.getLayout()
            view = wrapped.restrictedTraverse(layout)
        else:
            raise NotFound
        return view()
 def publishTraverse(self, request, name):
     try:
         # first see if it can be traversed
         # or if there is a view for this object
         route = self.route
         from collective.routes import getObject
         wrapped = getObject(route, self, request)
         return self.boboTraverse(wrapped, request, name)
     except (AttributeError, NotFound):
         # okay, now try to use url fragments to continue
         # traversal
         if len(self.fragments) > 0:
             return self.getFragmentContext(request, name)
     raise NotFound