[Teammetrics-discuss] Please strip quotation marks from names

Andreas Tille andreas at an3as.eu
Sat Mar 16 08:58:54 UTC 2013


On Sat, Mar 16, 2013 at 12:39:24AM -0400, Sukhbir Singh wrote:
> Ok, I just fixed this. We now strip the single quote at the front and
> end of a name.

$ git diff HEAD^..HEAD
diff --git a/archiveparser.py b/archiveparser.py
index 447e68b..107d34e 100755
--- a/archiveparser.py
+++ b/archiveparser.py
@@ -226,7 +226,7 @@ def main(conn, cur):
                     # Some names have the form: LastName, FirstName. 
                     if ',' in name:
                         name = ' '.join(e for e in reversed(name.split())).replace(',', '').strip()
-                    name = HTMLParser.HTMLParser().unescape(name).strip()
+                    name = HTMLParser.HTMLParser().unescape(name).strip().strip("'");
 
                     # Subject field.
                     subject = fields.get('Subject', '')


I guess you also need to add some

    strip('"')

because also double quotes might occure.
 
> >   ' ALLAN W. BART
> >   'cduck' Chris Grierson

I think your code works not really well on these kind of strings.  On
one hand in the case

   ' ALLAN W. BART

there will be a remaining blank (which could be solved by another
strip()) but it will only remove the leading ' in

    'cduck' Chris Grierson

which is confusing.  That's why I would prefer some "symmetric removal"
to only remove the quotes of they occure in the beginning and the end of
a name.

Kind regards

      Andreas.

-- 
http://fam-tille.de



More information about the Teammetrics-discuss mailing list