def run_dialog(): """Creates and launches the New Feed dialog. This dialog waits for the user to press "Create Podcast" or "Cancel". Returns the URL, or None. """ text = app.widgetapp.get_clipboard_text() if text and feed.validate_feed_url(text): text = feed.normalize_feed_url(text) else: text = "" title = _('Add Podcast') description = _('Enter the URL of the podcast to add') while 1: text = _run_dialog(title, description, initial_text=text) if text == None: return None normalized_url = feed.normalize_feed_url(text) if feed.validate_feed_url(normalized_url): return normalized_url title = _('Add Podcast - Invalid URL') description = _( 'The address you entered is not a valid url. ' 'Please check the URL and try again.' '\n\n' 'Enter the URL of the podcast to add')
def run_dialog(): """Creates and launches the New Feed dialog. This dialog waits for the user to press "Create Feed" or "Cancel". Returns a tuple of the (url, section). """ text = app.widgetapp.get_clipboard_text() if text and feed.validate_feed_url(text): text = feed.normalize_feed_url(text) else: text = "" title = _('Add Feed') description = _('Enter the URL of the feed to add') while 1: text, section = _run_dialog(title, description, initial_text=text) if text == None: return (None, None) normalized_url = feed.normalize_feed_url(text) if feed.validate_feed_url(normalized_url): return (normalized_url, section) title = _('Add Feed - Invalid URL') description = _('The address you entered is not a valid url.\nPlease check the URL and try again.\n\nEnter the URL of the feed to add')
def run_dialog(): """Creates and launches the New Feed dialog. This dialog waits for the user to press "Create Podcast" or "Cancel". Returns the URL, or None. """ text = app.widgetapp.get_clipboard_text() if text and feed.validate_feed_url(text): text = feed.normalize_feed_url(text) else: text = "" title = _('Add Podcast') description = _('Enter the URL of the podcast to add') while 1: text = _run_dialog(title, description, initial_text=text) if text == None: return None normalized_url = feed.normalize_feed_url(text) if feed.validate_feed_url(normalized_url): return normalized_url title = _('Add Podcast - Invalid URL') description = _('The address you entered is not a valid url. ' 'Please check the URL and try again.' '\n\n' 'Enter the URL of the podcast to add')
def test_negative(self): for testurl in [u"feed://foo.bar.com/", u"http://foo.bar.com", u"http:foo.bar.com/", u"https:foo.bar.com/", u"feed:foo.bar.com/", u"http:/foo.bar.com/", u"https:/foo.bar.com/", u"feed:/foo.bar.com/", u"http:///foo.bar.com/", u"https:///foo.bar.com/", u"feed:///foo.bar.com/", u"foo.bar.com", u"crap:foo.bar.com", u"crap:/foo.bar.com", u"crap://foo.bar.com", u"crap:///foo.bar.com", ]: self.assertEqual(validate_feed_url(testurl), False)
def test_negative(self): for testurl in [ u"feed://foo.bar.com/", u"http://foo.bar.com", u"http:foo.bar.com/", u"https:foo.bar.com/", u"feed:foo.bar.com/", u"http:/foo.bar.com/", u"https:/foo.bar.com/", u"feed:/foo.bar.com/", u"http:///foo.bar.com/", u"https:///foo.bar.com/", u"feed:///foo.bar.com/", u"foo.bar.com", u"crap:foo.bar.com", u"crap:/foo.bar.com", u"crap://foo.bar.com", u"crap:///foo.bar.com", ]: self.assertEqual(validate_feed_url(testurl), False)
def test_positive(self): for testurl in [ u"http://foo.bar.com/", u"https://foo.bar.com/", ]: self.assertEqual(validate_feed_url(testurl), True)
def test_positive(self): for testurl in [u"http://foo.bar.com/", u"https://foo.bar.com/", ]: self.assertEqual(validate_feed_url(testurl), True)