def __getattr__(self, attr): """ Parameters missing on this class are requested from the http response object. """ try: self.val = deserialize(self.utf8, attr) except AttributeError: #TODO Serialization error raise else: return self.val
def parse(self, type=None, **kwargs): """Do something smart to the data to discover its type""" if not type: type = self.headers['Content-Type'] return deserialize(self.raw, type)
def resolve(self, request): if request.method in {"PUT", "POST", "PATCH"}: request["data"] = deserialize(request.content, request.content_type) return self.application(request)