labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1519551 - in /labs/panopticon: src/asf/utils/emails.py tests/test_emails.py
Date Tue, 03 Sep 2013 04:32:43 GMT
Author: adc
Date: Tue Sep  3 04:32:43 2013
New Revision: 1519551

URL: http://svn.apache.org/r1519551
Log:
Canonicalize gmail addresses

Modified:
    labs/panopticon/src/asf/utils/emails.py
    labs/panopticon/tests/test_emails.py

Modified: labs/panopticon/src/asf/utils/emails.py
URL: http://svn.apache.org/viewvc/labs/panopticon/src/asf/utils/emails.py?rev=1519551&r1=1519550&r2=1519551&view=diff
==============================================================================
--- labs/panopticon/src/asf/utils/emails.py (original)
+++ labs/panopticon/src/asf/utils/emails.py Tue Sep  3 04:32:43 2013
@@ -29,6 +29,8 @@ from brownie.caching import memoize
 def canonical_email_address(email):
     if '@' in email:
         local, domain = email.split('@')
+        if domain == 'gmail.com':
+            local = local.lower().replace('.', '')
         return '%s@%s' % (local, domain.lower())
     else:
         return email
@@ -56,6 +58,11 @@ def aliases_for(apache_email, mail_alias
 
 
 def email_from_alias(alias_email, mail_aliases):
+    """ Obtain the Apache email address from an email alias
+    :param alias_email: the email alias to use to lookup the Apache email address
+    :param mail_aliases: the dictionary of email aliases
+    :return: the Apache email address associated with the email alias, else None
+    """
     alias_email = canonical_email_address(alias_email)
     for apache_email_address, data in mail_aliases.iteritems():
         if alias_email in data['aliases']:

Modified: labs/panopticon/tests/test_emails.py
URL: http://svn.apache.org/viewvc/labs/panopticon/tests/test_emails.py?rev=1519551&r1=1519550&r2=1519551&view=diff
==============================================================================
--- labs/panopticon/tests/test_emails.py (original)
+++ labs/panopticon/tests/test_emails.py Tue Sep  3 04:32:43 2013
@@ -43,7 +43,7 @@ def test_aliases_for(username, password)
     aliases = aliases_for('adc@ApAcHe.org', get_mail_aliases(username, password))
     assert 'adc@toolazydogs.com' in aliases
     assert 'list@toolazydogs.com' in aliases
-    assert 'alan.cabrera@gmail.com' in aliases
+    assert 'alancabrera@gmail.com' in aliases
 
 
 @attr('integration')



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message