diff options
-rw-r--r-- | browser.py | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -581,6 +581,12 @@ class Browser(WebKit.WebView): self.__mime_type_policy_cb) self.connect('load-error', self.__load_error_cb) + if os.path.isfile(os.path.join(os.environ['SUGAR_HOME'], "perm_sites")): + with open(os.path.join(os.environ['SUGAR_HOME'], "perm_sites")) as f: + for line in f: + if uri = line: + self.emit('load-error') + self._inject_media_style = False ContentInvoker(self) @@ -755,13 +761,33 @@ class Browser(WebKit.WebView): 'title': _('This web page could not be loaded'), 'message': _('"%s" could not be loaded. Please check for ' 'typing errors, and make sure you are connected ' - 'to the Internet.') % uri, + 'to the internet.') % uri, + 'btn_value': _('Try again'), + 'url': uri, + } + controldata = { + 'page_title': _('You\'re not allowed to visit this page'), + 'title': _('You\'re not allowed to visit this page'), + 'message': _('"%s" could not be loaded. Please make sure ' + 'this site has not been blacklisted in your ' + 'parental controls.') % uri, 'btn_value': _('Try again'), 'url': uri, } - html = open(DEFAULT_ERROR_PAGE, 'r').read() % data - web_frame.load_alternate_string(html, uri, uri) + if os.path.isfile(os.path.join(os.environ['SUGAR_HOME'], "nointernet")): + html = open(DEFAULT_ERROR_PAGE, 'r').read() % controldata + web_frame.load_alternate_string(html, uri, uri) + + if os.path.isfile(os.path.join(os.environ['SUGAR_HOME'], "perm_sites")): + with open(os.path.join(os.environ['SUGAR_HOME'], "perm_sites")) as f: + for line in f: + if uri = line: + html = open(DEFAULT_ERROR_PAGE, 'r').read() % controldata + web_frame.load_alternate_string(html, uri, uri) + else: + html = open(DEFAULT_ERROR_PAGE, 'r').read() % data + web_frame.load_alternate_string(html, uri, uri) return True |