From 6b202c59925c3e3004df1650df96366e53b70391 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 30 Oct 2011 18:31:32 -0400 Subject: [PATCH] Fix. --- bot/tasks/afc_statistics.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bot/tasks/afc_statistics.py b/bot/tasks/afc_statistics.py index 1a435ad..79a6edc 100644 --- a/bot/tasks/afc_statistics.py +++ b/bot/tasks/afc_statistics.py @@ -204,7 +204,7 @@ class Task(BaseTask): cursor.execute(query1, (source,)) result = cursor.fetchall() if result: - res = self.site.sql_query(query2, self.split_title(dest))) + res = self.site.sql_query(query2, self.split_title(dest)) try: new_oldid = list(res)[0][0] except IndexError: @@ -213,16 +213,6 @@ class Task(BaseTask): else: self.track_page(cursor, dest) - def split_title(self, title): - namespace, body = title.split(":", 1)[0] - if not body: - return 0, title - try: - ns = self.site.namespace_name_to_id(namespace) - except wiki.NamespaceNotFoundError: - return 0, title - return ns, body - def process_delete(self, page, **kwargs): query = "SELECT page_id FROM page WHERE page_namespace = ? AND page_title = ?" with self.conn.cursor() as cursor, self.db_access_lock: @@ -316,6 +306,16 @@ class Task(BaseTask): query = "UPDATE page SET page_notes = ? WHERE page_id = ?" cursor.execute(query, (notes, pageid)) + def split_title(self, title): + namespace, body = title.split(":", 1)[0] + if not body: + return 0, title + try: + ns = self.site.namespace_name_to_id(namespace) + except wiki.NamespaceNotFoundError: + return 0, title + return ns, body + def get_status_and_chart(self, page): content = page.get() if page.is_redirect():