From 177b93ac21486c32afba543f77b9273f994f5e20 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 6 Nov 2012 08:18:53 -0600 Subject: Make guid feeds helper a @staticfunction Signed-off-by: Dan McGee --- feeds.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/feeds.py b/feeds.py index 55275ead..d00aec87 100644 --- a/feeds.py +++ b/feeds.py @@ -11,21 +11,24 @@ from main.models import Arch, Repo, Package from news.models import News -def check_for_unique_id(f): - def wrapper(name, contents=None, attrs=None): - if attrs is None: - attrs = {} - if name == 'guid': - attrs['isPermaLink'] = 'false' - return f(name, contents, attrs) - return wrapper class GuidNotPermalinkFeed(Rss201rev2Feed): + @staticmethod + def check_for_unique_id(f): + def wrapper(name, contents=None, attrs=None): + if attrs is None: + attrs = {} + if name == 'guid': + attrs['isPermaLink'] = 'false' + return f(name, contents, attrs) + return wrapper + def write_items(self, handler): # Totally disgusting. Monkey-patch the hander so if it sees a # 'unique-id' field come through, add an isPermalink="false" attribute. # Workaround for http://code.djangoproject.com/ticket/9800 - handler.addQuickElement = check_for_unique_id(handler.addQuickElement) + handler.addQuickElement = self.check_for_unique_id( + handler.addQuickElement) super(GuidNotPermalinkFeed, self).write_items(handler) -- cgit v1.2.3-54-g00ecf