Exemple #1
0
  def testisFeedURLValid(self):
    """Test whether the urls in self.feedurls are valid feed url.
    """
    # invalid: not a feed url
    self.assertFalse(validate.isFeedURLValid('http://www.google.com'))

    self.assertFalse(validate.isFeedURLValid(''))

    self.assertTrue(validate.isFeedURLValid(
        'http://googlesummerofcode.blogspot.com/feeds/posts/default'))

    # invalid: wrong protocol
    self.assertFalse(validate.isFeedURLValid('htp://example.com'))
    def testisFeedURLValid(self):
        """Test whether the urls in self.feedurls are valid feed url.
    """
        # invalid: not a feed url
        self.assertFalse(validate.isFeedURLValid('http://www.google.com'))

        self.assertFalse(validate.isFeedURLValid(''))

        self.assertTrue(
            validate.isFeedURLValid(
                'http://googlesummerofcode.blogspot.com/feeds/posts/default'))

        # invalid: wrong protocol
        self.assertFalse(validate.isFeedURLValid('htp://example.com'))
Exemple #3
0
  def wrapper(self):
    """Decorator wrapped method.
    """
    feed_url = self.cleaned_data.get(field_name)

    if feed_url == '':
      # feed url not supplied (which is OK), so do not try to validate it
      return None

    if not validate.isFeedURLValid(feed_url):
      raise forms.ValidationError('This URL is not a valid ATOM or RSS feed.')

    return feed_url
Exemple #4
0
    def wrapper(self):
        """Decorator wrapped method.
    """
        feed_url = self.cleaned_data.get(field_name)

        if feed_url == '':
            # feed url not supplied (which is OK), so do not try to validate it
            return None

        if not validate.isFeedURLValid(feed_url):
            raise forms.ValidationError(
                'This URL is not a valid ATOM or RSS feed.')

        return feed_url