[Teammetrics-discuss] Please strip quotation marks from names

Andreas Tille andreas at an3as.eu
Sat Apr 6 16:05:43 UTC 2013


On Fri, Apr 05, 2013 at 12:34:13AM -0400, Sukhbir Singh 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.

Yes, this actually fits my suggestion (at least for non-pathological
combinations of quotation marks).

Thanks

      Andreas.

-- 
http://fam-tille.de



More information about the Teammetrics-discuss mailing list