def save_channel(self, creator, feed_url): if Channel.objects.filter(url=feed_url).count(): raise forms.ValidationError(_("Feed URL already exists")) channel = Channel() channel.url = feed_url channel.owner = creator self.update_channel(channel) return channel
def test_thumbnail_before_save(self): c = Channel() c.url = "http://myblog.com/videos/rss" c.website_url = "http://myblog.com/" c.publisher = "TestVision" c.description = "lots of stuff" self.assertRaises(ValueError, c.save_thumbnail, file(test_data_path('thumbnail.jpg')))