From efca6018edf406ef1a646976468af07ed545b8b8 Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Tue, 20 Oct 2009 01:02:12 +0000 Subject: [PATCH] support other response types in proxy object --- direct/src/http/WebRequest.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/direct/src/http/WebRequest.py b/direct/src/http/WebRequest.py index 0df399a5d0..7e7bc58744 100755 --- a/direct/src/http/WebRequest.py +++ b/direct/src/http/WebRequest.py @@ -72,12 +72,15 @@ class SkinningReplyTo: self._headTags = self._dispatcher._headTags[:] self._dispatcher._clearHeadTags() - def respond(self, response): + def respondHTTP(self,status,body): if self._doSkin: self._addHeadTags() - response = self._dispatcher.landingPage.skin(response, self._uri) + body = self._dispatcher.landingPage.skin(body, self._uri) self._removeHeadTags() - self._replyTo.respond(response) + self._replyTo.respondHTTP(status, body) + + def respond(self, response): + self.respondHTTP("200 OK", response) def addTagToHead(self, tag): self._headTags.append(tag) @@ -92,6 +95,14 @@ class SkinningReplyTo: for tag in self._headTags: head.remove(tag) + def __getattr__(self, attrName): + if not hasattr(self, attrName): + # pass-through to replyTo object which this object is a proxy to + return getattr(self._replyTo, attrName) + if attrName in self.__dict__: + return self.__dict__[attrName] + return getattr(self.__class__, attrName) + class WebRequestDispatcher(object): """ Request dispatcher for HTTP requests.