コード例 #1
0
ファイル: newfeed.py プロジェクト: CodeforEvolution/miro
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')
コード例 #2
0
ファイル: newfeed.py プロジェクト: cool-RR/Miro
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')
コード例 #3
0
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')
コード例 #4
0
ファイル: feedtest.py プロジェクト: cool-RR/Miro
 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)
コード例 #5
0
ファイル: feedtest.py プロジェクト: zjmmjzzjm/miro
 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)
コード例 #6
0
ファイル: feedtest.py プロジェクト: zjmmjzzjm/miro
 def test_positive(self):
     for testurl in [
             u"http://foo.bar.com/",
             u"https://foo.bar.com/",
     ]:
         self.assertEqual(validate_feed_url(testurl), True)
コード例 #7
0
ファイル: feedtest.py プロジェクト: cool-RR/Miro
 def test_positive(self):
     for testurl in [u"http://foo.bar.com/",
                     u"https://foo.bar.com/",
                     ]:
         self.assertEqual(validate_feed_url(testurl), True)