[Teammetrics-discuss] Please strip quotation marks from names
    Sukhbir Singh 
    sukhbir.in at gmail.com
       
    Fri Apr  5 04:34:13 UTC 2013
    
    
  
Hi Andreas,
Andreas Tille wrote:
> 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.
diff --git a/archiveparser.py b/archiveparser.py
index 107d34e..b660fbf 100755
--- a/archiveparser.py
+++ b/archiveparser.py
@@ -226,7 +226,9 @@ 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().strip("'");
+                    name = HTMLParser.HTMLParser().unescape(name).strip()
+                    if name.startswith(("'", '"')) and name.endswith(("'", '"')):
+                        name = name.strip("'").strip('"')
 
                     # Subject field.
                     subject = fields.get('Subject', '')
I think now it is better.
-- 
Sukhbir
    
    
More information about the Teammetrics-discuss
mailing list