model: Add rewrite_url() function. Bug 1905

This commit is contained in:
Thomas Perl 2014-04-01 22:35:39 +02:00
parent d81d7617d3
commit c576997c4a
1 changed files with 11 additions and 0 deletions

View File

@ -807,6 +807,17 @@ class PodcastChannel(PodcastModelObject):
else:
logger.warn('Cannot set strategy to %d', download_strategy)
def rewrite_url(self, new_url):
new_url = util.normalize_feed_url(new_url)
if new_url is None:
return None
self.url = new_url
self.http_etag = None
self.http_last_modified = None
self.save()
return new_url
def check_download_folder(self):
"""Check the download folder for externally-downloaded files