def openMunkiURL(self, url): '''Display page associated with munki:// url''' parsed_url = urlparse(url) if parsed_url.scheme != 'munki': msclog.debug_log("URL %s has unsupported scheme" % url) return filename = mschtml.unquote(parsed_url.netloc) # add .html if no extension if not os.path.splitext(filename)[1]: filename += u'.html' if filename.endswith(u'.html'): mschtml.build_page(filename) self.mainWindowController.load_page(filename) else: msclog.debug_log("%s doesn't have a valid extension. Prevented from opening" % url)
def openURL_withReplyEvent_(self, event, replyEvent): '''Handle openURL messages''' keyDirectObject = struct.unpack(">i", "----")[0] url = event.paramDescriptorForKeyword_(keyDirectObject).stringValue().decode('utf8') msclog.log("MSU", "Called by external URL: %s", url) parsed_url = urlparse(url) if parsed_url.scheme != 'munki': msclog.debug_log("URL %s has unsupported scheme" % url) return filename = mschtml.unquote(parsed_url.netloc) # add .html if no extension if not os.path.splitext(filename)[1]: filename += u'.html' if filename.endswith(u'.html'): mschtml.build_page(filename) self.mainWindowController.load_page(filename) else: msclog.debug_log("%s doesn't have a valid extension. Prevented from opening" % url)
def openURL_withReplyEvent_(self, event, replyEvent): '''Handle openURL messages''' keyDirectObject = struct.unpack(">i", "----")[0] url = event.paramDescriptorForKeyword_( keyDirectObject).stringValue().decode('utf8') msclog.log("MSU", "Called by external URL: %s", url) parsed_url = urlparse(url) if parsed_url.scheme != 'munki': msclog.debug_log("URL %s has unsupported scheme" % url) return filename = mschtml.unquote(parsed_url.netloc) # add .html if no extension if not os.path.splitext(filename)[1]: filename += u'.html' if filename.endswith(u'.html'): mschtml.build_page(filename) self.mainWindowController.load_page(filename) else: msclog.debug_log( "%s doesn't have a valid extension. Prevented from opening" % url)