Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Quiñones <manuq@laptop.org>2011-11-17 01:48:44 (GMT)
committer Manuel Quiñones <manuq@laptop.org>2011-11-17 01:48:44 (GMT)
commit56da020d44397ba9e6b82529bdf1273c8d556397 (patch)
tree20cce582d1b6a6c37f2276bb046d2e5844fbbc4e
parenta11e0a0f5a9f127a2831cdb060d4267073eecf84 (diff)
Allow url without 'http://'HEADmaster
Use urlparse to set default scheme http. Signed-off-by: Manuel Quiñones <manuq@laptop.org>
-rw-r--r--browser.py7
-rw-r--r--webtoolbar.py4
2 files changed, 9 insertions, 2 deletions
diff --git a/browser.py b/browser.py
index 8881b55..30b9600 100644
--- a/browser.py
+++ b/browser.py
@@ -18,6 +18,7 @@
import os
import time
+from urlparse import urlparse
from gettext import gettext as _
from gi.repository import GObject, Gtk, Pango, WebKit
@@ -42,6 +43,10 @@ else:
_UNTITLED_TEXT = _('Untitled')
+def parse_url(url):
+ return urlparse(url, scheme="http").geturl()
+
+
class TabbedView(BrowserNotebook):
__gtype_name__ = 'TabbedView'
@@ -83,7 +88,7 @@ class TabbedView(BrowserNotebook):
def __new_tab_cb(self, browser, url):
new_browser = self.add_tab(next_to_current=True)
- new_browser.load_uri(url)
+ new_browser.load_uri(parse_url(url))
new_browser.grab_focus()
def add_tab(self, next_to_current=False):
diff --git a/webtoolbar.py b/webtoolbar.py
index db45cb1..70f59d5 100644
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -33,6 +33,7 @@ from sugar3.activity.widgets import StopButton
#import filepicker
import places
+from browser import parse_url
_MAX_HISTORY_ENTRIES = 15
@@ -380,7 +381,8 @@ class PrimaryToolbar(ToolbarBase):
def _entry_activate_cb(self, entry):
browser = self._tabbed_view.props.current_browser
- browser.load_uri(entry.props.text)
+ url = parse_url(entry.props.text)
+ browser.load_uri(url)
browser.grab_focus()
def _go_home_cb(self, button):