示例#1
0
 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
示例#2
0
 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)
示例#3
0
 def resolve(self, request):
     if request.method in {"PUT", "POST", "PATCH"}:
         request["data"] = deserialize(request.content, request.content_type)
     return self.application(request)