def dispatch_request(self, request): scanner.LOCAL.request = request adapter = scanner.GLOBAL['routemap'].bind_to_environ(request.environ) try: endpoint, args = adapter.match() except HTTPException as e: return e (megamodule, clsName, methodName) = endpoint.split(".") cls = scanner.getClass(megamodule, clsName) view = cls(request) response = view.dispatch(methodName, args) del scanner.LOCAL.request return response
def partial(partialName, context=None): if context is None: context = {} request = scanner.LOCAL.request (megamodule, name) = partialName.split(".") try: partialClass = scanner.getClass(megamodule, name) except ClassNotFound: try: return templating.renderTemplate(partialName, context) except TemplateNotFound: raise PartialNotFound() partial = partialClass(request) return partial.render(**context)