def _ds_helper(self, node, insertFunction, convertFunction, basedir=None): childtext = getChildText(node) if basedir and node.nodeName == "string" and node.getAttribute( 'relative'): childtext = uriparse.UnRelativize(basedir, childtext, node.getAttribute('relative')) insertFunction(convertFunction(childtext))
def _ds_helper(self, node, insertFunction, convertFunction, basedir=None): childtext = self._ds_helper_get_child_text(node) if childtext is None: # For strings we insert the empty string. However, for # other types it implies something bad, but we shouldn't # fail totally! if node.nodeName == "string": try: insertFunction(node.getAttribute('id'), convertFunction('')) except KeyError: insertFunction("", convertFunction("")) else: log.debug("Node '%s' is empty - pretending it doesnt exist!", node) else: if basedir and node.nodeName == "string" and node.getAttribute('relative'): childtext = uriparse.UnRelativize(basedir, childtext, node.getAttribute('relative')) if childtext: insertFunction(node.getAttribute('id'), convertFunction(childtext))