From: James Troup Date: Wed, 23 Jun 2004 23:11:47 +0000 (+0000) Subject: 2004-06-24 James Troup * test/006/test.py (main): check brackete... X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=e7556dca76d2e8249fb7c8ddb1ce99a3c0211b32;p=dak.git 2004-06-24 James Troup * test/006/test.py (main): check bracketed email-only form. * utils.py (fix_maintainer): if the Maintainer string is bracketed email-only, strip the brackets so we don't end up with <>. --- diff --git a/test/006/test.py b/test/006/test.py index 99e1e1bf..d3d90919 100755 --- a/test/006/test.py +++ b/test/006/test.py @@ -3,7 +3,7 @@ # Test utils.fix_maintainer() # Copyright (C) 2004 James Troup -# $Id: test.py,v 1.1 2004-04-03 02:49:54 troup Exp $ +# $Id: test.py,v 1.2 2004-06-23 23:11:51 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -100,6 +100,14 @@ def main (): xd = "james@nocrew.org" check_valid(s, xa, xb, xc, xd); + # Check bracketed just-email form + s = "" + xa = " " + xb = " " + xc = "" + xd = "james@nocrew.org" + check_valid(s, xa, xb, xc, xd); + # Check Krazy quoted-string local part email address s = "Cris van Pelt <\"Cris van Pelt\"@tribe.eu.org>" xa = "Cris van Pelt <\"Cris van Pelt\"@tribe.eu.org>" diff --git a/utils.py b/utils.py index 0dea7de1..06560355 100644 --- a/utils.py +++ b/utils.py @@ -2,7 +2,7 @@ # Utility functions # Copyright (C) 2000, 2001, 2002, 2003, 2004 James Troup -# $Id: utils.py,v 1.67 2004-04-07 14:23:30 dsilvers Exp $ +# $Id: utils.py,v 1.68 2004-06-23 23:11:47 troup Exp $ ################################################################################ @@ -327,10 +327,12 @@ switched to 'email (name)' format.""" if not maintainer: return ('', '', '', ''); - if maintainer.find("<") == -1 or (maintainer[0] == "<" and \ - maintainer[-1:] == ">"): + if maintainer.find("<") == -1: email = maintainer; name = ""; + elif (maintainer[0] == "<" and maintainer[-1:] == ">"): + email = maintainer[1:-1]; + name = ""; else: m = re_parse_maintainer.match(maintainer); if not m: