Package: nm.debian.org
Severity: wishlist
Tags: patch

Hi,

Attached is the following:

  commit f6d5b0102ba9859cbcea6bfd02494511bd5b3c2b
  Author: Chris Lamb <[email protected]>
  Date:   Sat Sep 9 21:57:48 2017 +0100
  
      Add pronouns to ALL_STATUS_DESC.
  
   backend/const.py                              | 20 +++++++++++---------
   backend/housekeeping.py                       |  2 +-
   keyring/git_ops.py                            |  4 ++--
   maintenance/management/commands/weekreport.py |  4 ++--
   process/email.py                              |  4 ++--
   process/ops.py                                |  2 +-
   process/tests/test_approve.py                 |  4 ++--
   process/views.py                              | 10 ++++++----
   wizard/views.py                               | 14 +++++++-------
   9 files changed, 34 insertions(+), 30 deletions(-)

This fixes somewhat ugly grammar of, for example:

  "You are currently Debian Developer, uploading and you cannot
   become Debian Developer, non-uploading."

to

  "You are currently a Debian Developer, uploading and you cannot
   become a Debian Developer, non-uploading."

Thanks to Chris West (Faux) <[email protected]> for pointing
this out on IRC.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] / chris-lamb.co.uk
       `-
>From f6d5b0102ba9859cbcea6bfd02494511bd5b3c2b Mon Sep 17 00:00:00 2001
From: Chris Lamb <[email protected]>
Date: Sat, 9 Sep 2017 21:57:48 +0100
Subject: [PATCH] Add pronouns to ALL_STATUS_DESC.

---
 backend/const.py                              | 20 +++++++++++---------
 backend/housekeeping.py                       |  2 +-
 keyring/git_ops.py                            |  4 ++--
 maintenance/management/commands/weekreport.py |  4 ++--
 process/email.py                              |  4 ++--
 process/ops.py                                |  2 +-
 process/tests/test_approve.py                 |  4 ++--
 process/views.py                              | 10 ++++++----
 wizard/views.py                               | 14 +++++++-------
 9 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/backend/const.py b/backend/const.py
index 7aabde0..fdc3b83 100644
--- a/backend/const.py
+++ b/backend/const.py
@@ -1,22 +1,24 @@
 from collections import namedtuple
 
-Status = namedtuple("Status", ("code", "tag", "sdesc", "ldesc"))
+Status = namedtuple("Status", ("code", "tag", "sdesc", "pronoun", "ldesc"))
 Progress = namedtuple("Progress", ("code", "tag", "sdesc", "ldesc"))
 
 g = globals()
 
 # Status of a person in Debian
 ALL_STATUS = (
-    Status("STATUS_DC",            "dc",      "DC",              "Debian Contributor"),
-    Status("STATUS_DC_GA",         "dc_ga",   "DC+account",      "Debian Contributor, with guest account"),
-    Status("STATUS_DM",            "dm",      "DM",              "Debian Maintainer"),
-    Status("STATUS_DM_GA",         "dm_ga",   "DM+account",      "Debian Maintainer, with guest account"),
-    Status("STATUS_DD_U",          "dd_u",    "DD, upl.",        "Debian Developer, uploading"),
-    Status("STATUS_DD_NU",         "dd_nu",   "DD, non-upl.",    "Debian Developer, non-uploading"),
-    Status("STATUS_EMERITUS_DD",   "dd_e",    "DD, emeritus",    "Debian Developer, emeritus"),
-    Status("STATUS_REMOVED_DD",    "dd_r",    "DD, removed",     "Debian Developer, removed"),
+    Status("STATUS_DC",            "dc",      "DC",              "a", "Debian Contributor"),
+    Status("STATUS_DC_GA",         "dc_ga",   "DC+account",      "a", "Debian Contributor, with guest account"),
+    Status("STATUS_DM",            "dm",      "DM",              "a", "Debian Maintainer"),
+    Status("STATUS_DM_GA",         "dm_ga",   "DM+account",      "a", "Debian Maintainer, with guest account"),
+    Status("STATUS_DD_U",          "dd_u",    "DD, upl.",        "a", "Debian Developer, uploading"),
+    Status("STATUS_DD_NU",         "dd_nu",   "DD, non-upl.",    "a", "Debian Developer, non-uploading"),
+    Status("STATUS_EMERITUS_DD",   "dd_e",    "DD, emeritus",    "a", "Debian Developer, emeritus"),
+    Status("STATUS_REMOVED_DD",    "dd_r",    "DD, removed",     "a", "Debian Developer, removed"),
 )
 ALL_STATUS_DESCS = dict((x.tag, x.ldesc) for x in ALL_STATUS)
+ALL_STATUS_DESCS_WITH_PRONOUN = dict(
+    (x.tag, '{} {}'.format(x.pronoun, x.ldesc)) for x in ALL_STATUS)
 ALL_STATUS_BYTAG = dict((x.tag, x) for x in ALL_STATUS)
 for s in ALL_STATUS:
     g[s.code] = s.tag
diff --git a/backend/housekeeping.py b/backend/housekeeping.py
index 23bcff1..fb3b889 100644
--- a/backend/housekeeping.py
+++ b/backend/housekeeping.py
@@ -200,7 +200,7 @@ class PersonExpires(hk.Task):
                 log.info("%s: removing expiration date for %s who has become %s",
                          self.IDENTIFIER, self.hk.link(p), p.status)
                 p.expires = None
-                p.save(audit_author=self.hk.housekeeper.user, audit_notes="user became {}: removing expiration date".format(const.ALL_STATUS_DESCS[p.status]))
+                p.save(audit_author=self.hk.housekeeper.user, audit_notes="user became {}: removing expiration date".format(const.ALL_STATUS_DESCS_WITH_PRONOUN[p.status]))
             elif p.processes.exists() or pmodels.Process.objects.filter(person=p).exists():
                 log.info("%s: removing expiration date for %s who now has process history",
                          self.IDENTIFIER, self.hk.link(p))
diff --git a/keyring/git_ops.py b/keyring/git_ops.py
index ba7da4b..3b60568 100644
--- a/keyring/git_ops.py
+++ b/keyring/git_ops.py
@@ -350,7 +350,7 @@ class AddDD(Add):
 
         if person.status == role_status_map[self.role]:
             # Status already matches
-            #log.info("%s: %s is already %s: skipping duplicate entry", self.logtag, self.person_link(person), const.ALL_STATUS_DESCS[person.status])
+            #log.info("%s: %s is already %s: skipping duplicate entry", self.logtag, self.person_link(person), const.ALL_STATUS_DESCS_WITH_PRONOUN[person.status])
             return
 
         # Look for a process to close
@@ -369,7 +369,7 @@ class AddDD(Add):
                 audit_notes=logtext,
             )
             #log.info("%s: %s has an open process to become %s, keyring added them as %s",
-            #            self.logtag, self.person_link(person), const.ALL_STATUS_DESCS[p.applying_for], self.role)
+            #            self.logtag, self.person_link(person), const.ALL_STATUS_DESCS_WITH_PRONOUN[p.applying_for], self.role)
             found = True
 
         if not found:
diff --git a/maintenance/management/commands/weekreport.py b/maintenance/management/commands/weekreport.py
index 08f1637..8d8614c 100644
--- a/maintenance/management/commands/weekreport.py
+++ b/maintenance/management/commands/weekreport.py
@@ -112,7 +112,7 @@ class Reporter(object):
             counts[p.applying_for].append(p)
 
         for k, processes in sorted(iter(counts.items()), key=lambda x:const.SEQ_STATUS.get(x[0], 0)):
-            print("%d more people applied to become a %s:" % (len(counts[k]), const.ALL_STATUS_DESCS.get(k, "(unknown)")), file=out)
+            print("%d more people applied to become %s:" % (len(counts[k]), const.ALL_STATUS_DESCS_WITH_PRONOUN.get(k, "(unknown)")), file=out)
             self.print_proclist(out, processes, False)
 
         # Processes that ended
@@ -126,7 +126,7 @@ class Reporter(object):
             counts[p.applying_for].append(p)
 
         for k, processes in sorted(iter(counts.items()), key=lambda x:const.SEQ_STATUS.get(x[0], 0)):
-            print("%d people became a %s:" % (len(counts[k]), const.ALL_STATUS_DESCS.get(k, "(unknown)")), file=out)
+            print("%d people became %s:" % (len(counts[k]), const.ALL_STATUS_DESCS_WITH_PRONOUN.get(k, "(unknown)")), file=out)
             self.print_proclist(out, processes, False)
 
     def rep02_newams(self, out, **opts):
diff --git a/process/email.py b/process/email.py
index e70da51..c99a8d8 100644
--- a/process/email.py
+++ b/process/email.py
@@ -319,14 +319,14 @@ def notify_new_dd(process, request=None):
 
     body = """Hello,
 
-{process.person.fullname} <{process.person.uid}> has just become a {status}.
+{process.person.fullname} <{process.person.uid}> has just become {status}.
 
 The nm.debian.org page for this process is at {url}
 
 Debian New Member Front Desk
 """
 
-    body = body.format(process=process, status=const.ALL_STATUS_DESCS[process.applying_for], url=url)
+    body = body.format(process=process, status=const.ALL_STATUS_DESCS_WITH_PRONOUN[process.applying_for], url=url)
 
     msg = build_django_message(
         from_email=("nm.debian.org", "[email protected]"),
diff --git a/process/ops.py b/process/ops.py
index b037372..a7f5955 100644
--- a/process/ops.py
+++ b/process/ops.py
@@ -340,7 +340,7 @@ class ProcessApproveRT(op.Operation):
             self.set_null_field("rt_subject", "Guest account on porter machines for {}".format(self.process.person.fullname))
         else:
             self.set_null_field("rt_queue", "Keyring")
-            self.set_null_field("rt_subject", "{} to become {}".format(self.process.person.fullname, const.ALL_STATUS_DESCS[self.process.applying_for]))
+            self.set_null_field("rt_subject", "{} to become {}".format(self.process.person.fullname, const.ALL_STATUS_DESCS_WITH_PRONOUN[self.process.applying_for]))
 
         cc = [self.process.person.email, self.process.archive_email]
         if self.process.applying_for == "dm":
diff --git a/process/tests/test_approve.py b/process/tests/test_approve.py
index dade52e..68fa4e7 100644
--- a/process/tests/test_approve.py
+++ b/process/tests/test_approve.py
@@ -62,7 +62,7 @@ class TestApproveOp(ProcessFixtureMixin, TestCase):
             self.assertEqual(o.process, process)
             self.assertEqual(o.rt_queue, "Keyring")
             self.assertEqual(o.rt_requestor, "[email protected]")
-            self.assertEqual(o.rt_subject, person.fullname + " to become " + const.ALL_STATUS_DESCS[applying_for])
+            self.assertEqual(o.rt_subject, person.fullname + " to become " + const.ALL_STATUS_DESCS_WITH_PRONOUN[applying_for])
             self.assertEqual(o.rt_cc, "{}, archive-{}@nm.debian.org, [email protected]".format(person.email, process.pk))
 
     def _test_process_approve_dam_keyring(self, person, applying_for):
@@ -76,7 +76,7 @@ class TestApproveOp(ProcessFixtureMixin, TestCase):
             self.assertEqual(o.process, process)
             self.assertEqual(o.rt_queue, "Keyring")
             self.assertEqual(o.rt_requestor, "[email protected]")
-            self.assertEqual(o.rt_subject, person.fullname + " to become " + const.ALL_STATUS_DESCS[applying_for])
+            self.assertEqual(o.rt_subject, person.fullname + " to become " + const.ALL_STATUS_DESCS_WITH_PRONOUN[applying_for])
             self.assertEqual(o.rt_cc, "{}, archive-{}@nm.debian.org, [email protected]".format(person.email, process.pk))
 
 
diff --git a/process/views.py b/process/views.py
index b4438ff..f640441 100644
--- a/process/views.py
+++ b/process/views.py
@@ -325,7 +325,7 @@ class StatementCreate(RequirementMixin, FormView):
             ]
         #elif self.requirement.type == "intent":
         #    return [
-        #        "I would like to apply to change my status in Debian to {}".format(const.ALL_STATUS_DESCS[self.process.applying_for]),
+        #        "I would like to apply to change my status in Debian to {}".format(const.ALL_STATUS_DESCS_WITH_PRONOUN[self.process.applying_for]),
         #    ]
         return None
 
@@ -473,9 +473,9 @@ def make_rt_ticket_text(request, visitor, process):
     only_guest_account = only_needs_guest_account(process)
 
     if retiring:
-        req.append("Please make {person.fullname} (currently '{status}') a '{applying_for}'.")
+        req.append("Please make {person.fullname} (currently {status_with_pronoun}) {applying_for_with_pronoun}.")
     elif not only_guest_account:
-        req.append("Please make {person.fullname} (currently '{status}') a '{applying_for}' (advocated by {sponsors}).")
+        req.append("Please make {person.fullname} (currently {status_with_pronoun}) {applying_for_with_pronoun}' (advocated by {sponsors}).")
 
     if not only_guest_account:
         if process.person.status == const.STATUS_DC:
@@ -502,7 +502,9 @@ def make_rt_ticket_text(request, visitor, process):
         "person": process.person,
         "process": process,
         "status": const.ALL_STATUS_DESCS[process.person.status],
+        "status_with_pronoun": const.ALL_STATUS_DESCS_WITH_PRONOUN[process.person.status],
         "applying_for": const.ALL_STATUS_DESCS[process.applying_for],
+        "applying_for_with_pronoun": const.ALL_STATUS_DESCS_WITH_PRONOUN[process.applying_for],
         "sponsors": sponsors,
     }
 
@@ -549,7 +551,7 @@ class MakeRTTicket(VisitProcessMixin, TemplateView):
             ctx["subject"] = "[Debian RT] Guest account on porter machines for {}".format(self.person.fullname)
         else:
             ctx["mail_to"] = "Debian Keyring requests <[email protected]>"
-            ctx["subject"] = "[Debian RT] {} to become {}".format(self.person.fullname, const.ALL_STATUS_DESCS[self.process.applying_for])
+            ctx["subject"] = "[Debian RT] {} to become {}".format(self.person.fullname, const.ALL_STATUS_DESCS_WITH_PRONOUN[self.process.applying_for])
 
         ctx["only_guest_account"] = only_guest_account
 
diff --git a/wizard/views.py b/wizard/views.py
index 7fd5dfa..c1eaef8 100644
--- a/wizard/views.py
+++ b/wizard/views.py
@@ -69,7 +69,7 @@ class NewProcess(VisitorMixin, TemplateView):
         elif target == "return":
             target_desc = "Return from Emeritus"
         elif target in const.ALL_STATUS_DESCS:
-            target_desc = "Become {}".format(const.ALL_STATUS_DESCS[target])
+            target_desc = "Become {}".format(const.ALL_STATUS_DESCS_WITH_PRONOUN[target])
         else:
             target_desc = "Invalid"
 
@@ -79,21 +79,21 @@ class NewProcess(VisitorMixin, TemplateView):
                 if self.visitor.status in (const.STATUS_DM, const.STATUS_DM_GA):
                     comments.append("You are already a Debian Maintainer: problem solved!")
                 elif self.visitor.status not in (const.STATUS_DC, const.STATUS_DC_GA):
-                    comments.append("You are already a {}.".format(const.ALL_STATUS_DESCS[self.visitor.status]))
+                    comments.append("You are already {}.".format(const.ALL_STATUS_DESCS_WITH_PRONOUN[self.visitor.status]))
                 else:
                     allowed = const.STATUS_DM in whitelist or const.STATUS_DM_GA in whitelist
                     if not allowed:
                         comments.append("You cannot start a new process for Debian Maintainer. Did you already start one?")
             elif target == "ga":
                 if self.visitor.status not in (const.STATUS_DC, const.STATUS_DM):
-                    comments.append("As a {}, you should already have access to porter machines.".format(const.ALL_STATUS_DESCS[self.visitor.status]))
+                    comments.append("As {}, you should already have access to porter machines.".format(const._WITH_PRONOUN[self.visitor.status]))
                 else:
                     allowed = const.STATUS_DC_GA in whitelist or const.STATUS_DM_GA in whitelist
                     if not allowed:
                         comments.append("You cannot request a guest account. Did you already request it?")
             elif target == "return":
                 if self.visitor.status != const.STATUS_EMERITUS_DD:
-                    comments.append("You seem to be {}, not an Emeritus DD.".format(const.ALL_STATUS_DESCS[self.visitor.status]))
+                    comments.append("You seem to be {}, not an Emeritus DD.".format(const.ALL_STATUS_DESCS_WITH_PRONOUN[self.visitor.status]))
                 else:
                     allowed = True
             elif target not in const.ALL_STATUS_DESCS:
@@ -101,13 +101,13 @@ class NewProcess(VisitorMixin, TemplateView):
             else:
                 if target == self.visitor.status:
                     comments.append("You are already {}: problem solved!".format(
-                        const.ALL_STATUS_DESCS[target]))
+                        const.ALL_STATUS_DESCS_WITH_PRONOUN[target]))
                 else:
                     allowed = target in whitelist
                     if not allowed:
                         comments.append("You are currently {} and you cannot become {}.".format(
-                            const.ALL_STATUS_DESCS[self.visitor.status],
-                            const.ALL_STATUS_DESCS[target]))
+                            const.ALL_STATUS_DESCS_WITH_PRONOUN[self.visitor.status],
+                            const.ALL_STATUS_DESCS_WITH_PRONOUN[target]))
 
         ctx["comments"] = comments
         ctx["allowed"] = allowed
-- 
2.14.1

Reply via email to