From 088dfe61974b447b0b85ae0fcba0e1a0ce4bbde9 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Wed, 1 Mar 2017 00:08:37 -0600 Subject: [PATCH] Again, fix link and cleanup. --- copyvios/attribution.py | 8 +++++--- templates/index.mako | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/copyvios/attribution.py b/copyvios/attribution.py index bef99d4..75cefd8 100644 --- a/copyvios/attribution.py +++ b/copyvios/attribution.py @@ -18,8 +18,8 @@ ATTRIB_TEMPLATES = { def get_attribution_info(site, page): """Check to see if the given page has some kind of attribution info. - If yes, return a mwparserfromhell.nodes.Template object for the attribution - template. If no, return None. + If yes, return a tuple of (attribution template name, template URL). + If no, return None. """ if site.name not in ATTRIB_TEMPLATES: return None @@ -30,5 +30,7 @@ def get_attribution_info(site, page): for template in page.parse().ifilter_templates(): if template.name.matches(templates): - return template + name = unicode(template.name) + title = name if ":" in name else prefix + ":" + name + return name, site.get_page(title).url return None diff --git a/templates/index.mako b/templates/index.mako index f1705a4..8268c63 100644 --- a/templates/index.mako +++ b/templates/index.mako @@ -214,9 +214,8 @@ <% attrib = get_attribution_info(query.site, query.page) %> % if attrib: - <% attrib_page = query.site.get_page(unicode(attrib.name)) %>
- This article contains an attribution template: {{${attrib_page.title | h}}}. Please verify that any potential copyvios are not from properly attributed sources. + This article contains an attribution template: {{${attrib[0] | h}}}. Please verify that any potential copyvios are not from properly attributed sources.
% endif