def default(self, string): dom = utils.safe_minidom_parse_string(string) key_node = self.find_first_child_named(dom, 'keys') if not key_node: LOG.info(_LI("Unable to parse XML input.")) msg = _("Unable to parse XML request. " "Please provide XML in correct format.") raise webob.exc.HTTPBadRequest(explanation=msg) return {'body': {'keys': self._extract_keys(key_node)}}
def default(self, string): dom = utils.safe_minidom_parse_string(string) key_node = self.find_first_child_named(dom, 'keys') if not key_node: LOG.info(_LI("Unable to parse XML input.")) msg = _("Unable to parse XML request. " "Please provide XML in correct format.") raise webob.exc.HTTPBadRequest(explanation=msg) return {'body': {'keys': self._extract_keys(key_node)}}
def default(self, string): try: node = utils.safe_minidom_parse_string(string) except expat.ExpatError: msg = _("cannot understand XML") raise exception.MalformedRequestBody(reason=msg) updates = {} for child in node.childNodes[0].childNodes: updates[child.tagName] = self.extract_text(child) return dict(body=updates)
def default(self, string): try: node = utils.safe_minidom_parse_string(string) except expat.ExpatError: msg = _("cannot understand XML") raise exception.MalformedRequestBody(reason=msg) updates = {} for child in node.childNodes[0].childNodes: updates[child.tagName] = self.extract_text(child) return dict(body=updates)
def default(self, string): dom = utils.safe_minidom_parse_string(string) action_node = dom.childNodes[0] action_name = action_node.tagName action_data = {} attributes = ["force", "image_name", "container_format", "disk_format"] for attr in attributes: if action_node.hasAttribute(attr): action_data[attr] = action_node.getAttribute(attr) if 'force' in action_data and action_data['force'] == 'True': action_data['force'] = True return {'body': {action_name: action_data}}
def default(self, string): dom = utils.safe_minidom_parse_string(string) action_node = dom.childNodes[0] action_name = action_node.tagName action_data = {} attributes = ["force", "image_name", "container_format", "disk_format"] for attr in attributes: if action_node.hasAttribute(attr): action_data[attr] = action_node.getAttribute(attr) if 'force' in action_data and action_data['force'] == 'True': action_data['force'] = True return {'body': {action_name: action_data}}
def default(self, string): dom = utils.safe_minidom_parse_string(string) consistencygroup = self._extract_consistencygroup(dom) return {'body': {'consistencygroup': consistencygroup}}
def deserialize(self, text): dom = utils.safe_minidom_parse_string(text) metadata_node = self.find_first_child_named(dom, "metadata") metadata = self.extract_metadata(metadata_node) return {'body': {'metadata': metadata}}
def default(self, string): dom = utils.safe_minidom_parse_string(string) cgsnapshot = self._extract_cgsnapshot(dom) return {'body': {'cgsnapshot': cgsnapshot}}
def default(self, string): """Deserialize an xml-formatted volume create request.""" dom = utils.safe_minidom_parse_string(string) volume = self._extract_volume(dom) return {'body': {'volume': volume}}
def default(self, string): dom = utils.safe_minidom_parse_string(string) backup = self._extract_backup(dom) retval = {'body': {'backup-record': backup}} return retval
def default(self, string): dom = utils.safe_minidom_parse_string(string) transfer = self._extract_transfer(dom) return {'body': {'accept': transfer}}
def _extract_metadata_container(self, datastring): dom = utils.safe_minidom_parse_string(datastring) metadata_node = self.find_first_child_named(dom, "metadata") metadata = self.extract_metadata(metadata_node) return {'body': {'metadata': metadata}}
def update(self, datastring): dom = utils.safe_minidom_parse_string(datastring) metadata_item = self.extract_metadata(dom) return {'body': {'meta': metadata_item}}
def deserialize(self, text): dom = utils.safe_minidom_parse_string(text) metadata_item = self.extract_metadata(dom) return {'body': {'meta': metadata_item}}
def default(self, string): dom = utils.safe_minidom_parse_string(string) restore = self._extract_restore(dom) return {'body': {'restore': restore}}
def default(self, string): dom = utils.safe_minidom_parse_string(string) consistencygroup = self._extract_consistencygroup(dom) return {'body': {'consistencygroup': consistencygroup}}
def default(self, string): """Deserialize an xml-formatted volume create request.""" dom = utils.safe_minidom_parse_string(string) volume = self._extract_volume(dom) return {'body': {'volume': volume}}
def default(self, string): dom = utils.safe_minidom_parse_string(string) transfer = self._extract_transfer(dom) return {'body': {'accept': transfer}}