瀏覽代碼

update_case_title()

tags/v0.1^2
Ben Kurtovic 12 年之前
父節點
當前提交
ef4c7a187a
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. +10
    -0
      earwigbot/tasks/drn_clerkbot.py

+ 10
- 0
earwigbot/tasks/drn_clerkbot.py 查看文件

@@ -176,6 +176,10 @@ class DRNClerkBot(Task):
body = re.sub(re_id2, repl.format(id_), body) body = re.sub(re_id2, repl.format(id_), body)
case = _Case(id_, title, status) case = _Case(id_, title, status)
cases.append(case) cases.append(case)
else:
if case.title != title:
self.update_case_title(conn, id_, title)
case.title = title
case.body, case.old = body, old case.body, case.old = body, old


def select_next_id(self, conn): def select_next_id(self, conn):
@@ -208,6 +212,12 @@ class DRNClerkBot(Task):
return option return option
return self.STATUS_UNKNOWN return self.STATUS_UNKNOWN


def update_case_title(self, conn, id_, title):
"""Update a case title in the database."""
query = "UPDATE case SET case_title = ? WHERE case_id = ?"
with conn.cursor() as cursor:
cursor.execute(query, (title, id_))

def clerk(self): def clerk(self):
"""Actually go through cases and modify those to be updated.""" """Actually go through cases and modify those to be updated."""
notices = [] notices = []


Loading…
取消
儲存