def getChild(self, name, request):
"""
Dispatch a specific incoming request to an appropriate resource
"""
# First try: static resource
static = self.static.handle_static(request)
if static:
return static
# If that doesn't serve the request, try the plugin dynamic path
if request.path in self.path_map:
print 'using plugin %s for %s' % (self.path_map[request.path], request.path)
cfg = self.cfg.copy()
cfg['tab_map'] = self.tab_map
for arg in request.args:
if arg not in cfg:
cfg[arg] = request.args[arg][0]
# Augment the request with our own session data
request.sdata = session.get_data(request)
return self.path_map[request.path](cfg)
# Nothing else to try
print 'Failed to match path', request.path, 'to any plugins', self.path_map
return NoResource()
评论列表
文章目录