From 96eb7a660fb28654b667a90b8cbb79f9b3683da3 Mon Sep 17 00:00:00 2001 From: rdw Date: Thu, 20 Mar 2008 14:54:50 -0700 Subject: [PATCH] Parsed_body now raises ValueError if it can't find a parser. --- eventlet/httpd.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/eventlet/httpd.py b/eventlet/httpd.py index 91bf43c..59e698f 100644 --- a/eventlet/httpd.py +++ b/eventlet/httpd.py @@ -369,10 +369,15 @@ class Request(object): if not hasattr(self, '_cached_parsed_body'): body = self.read_body() if hasattr(self.site, 'parsers'): - parser = self.site.parsers.get( - self.get_header('content-type')) + ct = self.get_header('content-type') + parser = self.site.parsers.get(ct) + if parser is not None: body = parser(body) + else: + ex = ValueError("Could not find parser for content-type: %s" % ct) + ex.body = body + raise ex self._cached_parsed_body = body return self._cached_parsed_body