Przeglądaj źródła

update_case_title()

tags/v0.1^2
Ben Kurtovic 12 lat temu
rodzic
commit
ef4c7a187a
1 zmienionych plików z 10 dodań i 0 usunięć
  1. +10
    -0
      earwigbot/tasks/drn_clerkbot.py

+ 10
- 0
earwigbot/tasks/drn_clerkbot.py Wyświetl plik

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

def select_next_id(self, conn):
@@ -208,6 +212,12 @@ class DRNClerkBot(Task):
return option
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):
"""Actually go through cases and modify those to be updated."""
notices = []


Ładowanie…
Anuluj
Zapisz