def get_deserialize_handler(self, content_type): handlers = { 'application/json': self._from_json, 'application/xml': self._from_xml, } try: return handlers[content_type] except Exception: raise exception.InvalidContentType(content_type=content_type)
def get_deserialize_handler(self, content_type): handlers = { 'application/json': JSONDeserializer(), 'application/xml': XMLDeserializer(self.metadata), } try: return handlers[content_type] except Exception: raise exception.InvalidContentType(content_type=content_type)
def get_body_deserializer(self, content_type): try: return self.body_deserializers[content_type] except (KeyError, TypeError): raise exception.InvalidContentType(content_type=content_type)