diff options
author | Dan McGee <dan@archlinux.org> | 2012-11-06 08:18:53 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2012-11-06 08:18:53 -0600 |
commit | 177b93ac21486c32afba543f77b9273f994f5e20 (patch) | |
tree | b3d7bf61dbe69f9d322944a7de603ef80c3b9f2a | |
parent | 761084f280007e302fc9ae9c738b32fd0490bb70 (diff) |
Make guid feeds helper a @staticfunction
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | feeds.py | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -11,21 +11,24 @@ from main.utils import retrieve_latest 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) |