From c58e7138fe5ba6af8da8a973003ed1a8371645ad Mon Sep 17 00:00:00 2001 From: William McBrine Date: Fri, 22 Feb 2008 21:47:46 -0500 Subject: [PATCH] Even better, print an error message; consolidate the unsupported() calls; spacing. --- httpserver.py | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/httpserver.py b/httpserver.py index a91581c..cd5137d 100644 --- a/httpserver.py +++ b/httpserver.py @@ -86,34 +86,31 @@ class TivoHTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler): method(self, query) return else: - self.unsupported(query) - return - break - - #if we made it here it means we couldn't match the request to anything. - self.unsupported(query) - return - else: - self.unsupported(query) + break + + # If we made it here it means we couldn't match the request to + # anything. + self.unsupported(query) def root_container(self): - tsn = self.headers.getheader('TiVo_TCD_ID', '') - tsnshares = config.getShares(tsn) - tsncontainers = {} - for section, settings in tsnshares: - try: - settings['content_type'] = GetPlugin(settings['type']).CONTENT_TYPE + tsn = self.headers.getheader('TiVo_TCD_ID', '') + tsnshares = config.getShares(tsn) + tsncontainers = {} + for section, settings in tsnshares: + try: + settings['content_type'] = \ + GetPlugin(settings['type']).CONTENT_TYPE tsncontainers[section] = settings - except: - pass - t = Template(file=os.path.join(SCRIPTDIR, 'templates', - 'root_container.tmpl')) - t.containers = tsncontainers - t.hostname = socket.gethostname() - t.escape = escape - self.send_response(200) - self.end_headers() - self.wfile.write(t) + except Exception, msg: + print section, '-', msg + t = Template(file=os.path.join(SCRIPTDIR, 'templates', + 'root_container.tmpl')) + t.containers = tsncontainers + t.hostname = socket.gethostname() + t.escape = escape + self.send_response(200) + self.end_headers() + self.wfile.write(t) def infopage(self): self.send_response(200) -- 2.11.4.GIT