Browse Source

Allow first letter of usernames to be lowercase.

tags/v0.1^2
Ben Kurtovic 12 years ago
parent
commit
4899edc044
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      earwigbot/tasks/drn_clerkbot.py

+ 6
- 2
earwigbot/tasks/drn_clerkbot.py View File

@@ -148,9 +148,10 @@ class DRNClerkBot(Task):
text = text.split(marker)[1] text = text.split(marker)[1]
additions = set() additions = set()
for line in text.splitlines(): for line in text.splitlines():
user = re.search("\# \{\{User\|(.*?)\}\}", line)
user = re.search("\# \{\{User\|(.+?)\}\}", line)
if user: if user:
additions.add((user.group(1).replace("_", " ").strip(),))
uname = user.group(1).replace("_", " ").strip()
additions.add((uname[0].upper() + uname[1:],))


removals = set() removals = set()
query1 = "SELECT volunteer_username FROM volunteers" query1 = "SELECT volunteer_username FROM volunteers"
@@ -212,6 +213,7 @@ class DRNClerkBot(Task):
match = re.search(re_f, body, re.U) match = re.search(re_f, body, re.U)
if match: if match:
f_user = match.group(1).split("/", 1)[0].replace("_", " ") f_user = match.group(1).split("/", 1)[0].replace("_", " ")
f_user = f_user[0].upper() + f_user[1:]
strp = "%H:%M, %d %B %Y (UTC)" strp = "%H:%M, %d %B %Y (UTC)"
f_time = datetime.strptime(match.group(2), strp) f_time = datetime.strptime(match.group(2), strp)
else: else:
@@ -460,6 +462,7 @@ class DRNClerkBot(Task):
signatures = [] signatures = []
for userlink, stamp in matches: for userlink, stamp in matches:
username = userlink.split("/", 1)[0].replace("_", " ").strip() username = userlink.split("/", 1)[0].replace("_", " ").strip()
username = username[0].upper() + username[1:]
if username == "DoNotArchiveUntil": if username == "DoNotArchiveUntil":
continue continue
stamp = stamp.strip() stamp = stamp.strip()
@@ -493,6 +496,7 @@ class DRNClerkBot(Task):
user = re.search("[:*#]{,5} \{\{User\|(.*?)\}\}", line) user = re.search("[:*#]{,5} \{\{User\|(.*?)\}\}", line)
if user: if user:
party = user.group(1).replace("_", " ").strip() party = user.group(1).replace("_", " ").strip()
party = party[0].upper() + party[1:]
if party == case.file_user: if party == case.file_user:
continue continue
notice = _Notice("User talk:" + party, template, too_late) notice = _Notice("User talk:" + party, template, too_late)


Loading…
Cancel
Save