def _checkFilePathAttribute(self, node, attrName): fpath = node.getAttribute(attrName) uri = getUriFromFilePath(fpath) # Hack alert: we don't want to modify any URIs that contain the # special template directory token. if uri and not u"__RAVEN_TEMPLATE_DIR__" in uri: #$NON-NLS-1$ # decode url if it is in unicode 'quoted' (e.g. %20 etc). uri = decodeUri(uri) # if needed, convert hostname to IDNA. uri = encodeIDNA(uri) # re-encode to Raven conention i.e. internally, store content as IDNA (hostname) with Unicode paths uri = encodeUri(uri) node.setAttribute(attrName, uri )
def _checkFilePathAttribute(self, node, attrName): fpath = node.getAttribute(attrName) uri = getUriFromFilePath(fpath) # Hack alert: we don't want to modify any URIs that contain the # special template directory token. if uri and not u"__RAVEN_TEMPLATE_DIR__" in uri: #$NON-NLS-1$ # decode url if it is in unicode 'quoted' (e.g. %20 etc). uri = decodeUri(uri) # if needed, convert hostname to IDNA. uri = encodeIDNA(uri) # re-encode to Raven conention i.e. internally, store content as IDNA (hostname) with Unicode paths uri = encodeUri(uri) node.setAttribute(attrName, uri)
def openUrlInBrowser(self, url): # If the URL contains unicode characters, assume it is an international # URL and thus encode it using the 'idna' encoding if isUnicodePath(url): url = encodeIDNA(url) webbrowser.open_new(url)
def _checkFilePathAttribute(self, node, attrName): fpath = node.getAttribute(attrName) uri = getUriFromFilePath(fpath) if uri: uri = encodeIDNA(uri) node.setAttribute(attrName, uri )
def _checkFilePathAttribute(self, node, attrName): fpath = node.getAttribute(attrName) uri = getUriFromFilePath(fpath) if uri: uri = encodeIDNA(uri) node.setAttribute(attrName, uri)