[csw-devel] SF.net SVN: gar:[18167] csw/mgar/gar/v2/lib
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Wed May 30 00:27:05 CEST 2012
Revision: 18167
http://gar.svn.sourceforge.net/gar/?rev=18167&view=rev
Author: wahwah
Date: 2012-05-29 22:27:04 +0000 (Tue, 29 May 2012)
Log Message:
-----------
pkgdb-web: Better email handling
Some badly formatted emails don't have domains.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/models.py
csw/mgar/gar/v2/lib/web/pkgdb_web.py
Modified: csw/mgar/gar/v2/lib/python/models.py
===================================================================
--- csw/mgar/gar/v2/lib/python/models.py 2012-05-29 22:26:31 UTC (rev 18166)
+++ csw/mgar/gar/v2/lib/python/models.py 2012-05-29 22:27:04 UTC (rev 18167)
@@ -49,7 +49,14 @@
# bugs, e.g. "someone at opencsw.or".
def ObfuscatedEmail(self):
- username, domain = self.email.split("@")
+ if self.email:
+ email = self.email.split("@")
+ else:
+ email = ["unknown"]
+ if len(email) == 2:
+ username, domain = email
+ else:
+ username, domain = email[0], "no domain"
username = username[:-3] + "..."
return "@".join((username, domain))
Modified: csw/mgar/gar/v2/lib/web/pkgdb_web.py
===================================================================
--- csw/mgar/gar/v2/lib/web/pkgdb_web.py 2012-05-29 22:26:31 UTC (rev 18166)
+++ csw/mgar/gar/v2/lib/web/pkgdb_web.py 2012-05-29 22:27:04 UTC (rev 18167)
@@ -194,7 +194,14 @@
class MaintainerList(object):
def GET(self):
maintainers = models.Maintainer.select().orderBy('email')
- names = [tuple(x.email.split("@") + [x]) for x in maintainers]
+ names = []
+ for m in maintainers:
+ email = m.email.split("@")
+ # In case the email is not valid.
+ if len(email) >= 2:
+ names.append((email[0], email[1], m))
+ else:
+ names.append((email[0], "no domain", m))
return render.MaintainerList(names)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list