瀏覽代碼

Uh, fix?

tags/v0.1^2
Ben Kurtovic 13 年之前
父節點
當前提交
3614fb5f13
共有 1 個文件被更改,包括 9 次插入5 次删除
  1. +9
    -5
      bot/tasks/afc_statistics.py

+ 9
- 5
bot/tasks/afc_statistics.py 查看文件

@@ -425,12 +425,16 @@ class Task(BaseTask):
used in the task's code.
"""
query = "SELECT page_latest FROM page WHERE page_title = ? AND page_namespace = ?"
namespace, base = title.decode("utf8").split(":", 1)
try:
ns = self.site.namespace_name_to_id(namespace)
except wiki.NamespaceNotFoundError:
base = title
ns = wiki.NS_MAIN
namespace, base = title.decode("utf8").split(":", 1)
except ValueError:
base = title.decode("utf8")
else:
try:
ns = self.site.namespace_name_to_id(namespace)
except wiki.NamespaceNotFoundError:
base = title.decode("utf8")
ns = wiki.NS_MAIN

result = self.site.sql_query(query, (base.replace(" ", "_"), ns))
revid = int(list(result)[0][0])


Loading…
取消
儲存