[CMF-checkins] SVN: CMF/branches/2.1/C Even though the RFC does not allow it all-numeric domains do exist

Wichert Akkerman wichert at wiggy.net
Sun Aug 5 03:35:07 EDT 2007


Log message for revision 78592:
  Even though the RFC does not allow it all-numeric domains do exist

Changed:
  U   CMF/branches/2.1/CHANGES.txt
  U   CMF/branches/2.1/CMFDefault/tests/test_utils.py
  U   CMF/branches/2.1/CMFDefault/utils.py

-=-
Modified: CMF/branches/2.1/CHANGES.txt
===================================================================
--- CMF/branches/2.1/CHANGES.txt	2007-08-04 23:50:28 UTC (rev 78591)
+++ CMF/branches/2.1/CHANGES.txt	2007-08-05 07:35:06 UTC (rev 78592)
@@ -11,6 +11,11 @@
       and slashes. GenericSetup does only support registering objects which are
       in the site root.
 
+    - Allow email addresses with all-numeric domain names. The RFCs do not
+      support them but they do exist.  
+      (http://dev.plone.org/plone/ticket/6773)
+
+
 CMF 2.1.0-beta2 (2007/07/12)
 
   New Features

Modified: CMF/branches/2.1/CMFDefault/tests/test_utils.py
===================================================================
--- CMF/branches/2.1/CMFDefault/tests/test_utils.py	2007-08-04 23:50:28 UTC (rev 78591)
+++ CMF/branches/2.1/CMFDefault/tests/test_utils.py	2007-08-05 07:35:06 UTC (rev 78592)
@@ -248,6 +248,8 @@
         from Products.CMFDefault.utils import checkEmailAddress
 
         self.assertEqual(checkEmailAddress('foo at example.com'), None)
+        self.assertEqual(checkEmailAddress('foo at 1bar.example.com'), None)
+        self.assertEqual(checkEmailAddress('foo at 123456.com'), None)
         self.assertEqual(checkEmailAddress('$.- at example.com'), None)
         self.assertEqual(checkEmailAddress(u'foo at example.com'), None)
         # CMF Collector issue #322
@@ -265,8 +267,6 @@
         self.assertRaises(EmailAddressInvalid, checkEmailAddress,
                           '.foo at example.com')
         self.assertRaises(EmailAddressInvalid, checkEmailAddress,
-                          'foo at 1bar.example.com')
-        self.assertRaises(EmailAddressInvalid, checkEmailAddress,
                           'foo at -bar.example.com')
         # RFC 2821 local-part: max 64 characters
         self.assertRaises(EmailAddressInvalid, checkEmailAddress,

Modified: CMF/branches/2.1/CMFDefault/utils.py
===================================================================
--- CMF/branches/2.1/CMFDefault/utils.py	2007-08-04 23:50:28 UTC (rev 78591)
+++ CMF/branches/2.1/CMFDefault/utils.py	2007-08-05 07:35:06 UTC (rev 78592)
@@ -512,8 +512,9 @@
 # RFC 2821 local-part: max 64 characters
 # RFC 2821 domain: sequence of dot-separated labels
 # characters allowed in label: A-Za-z0-9-, first is a letter
-_DOMAIN_RE = re.compile(r'[^@]{1,64}@[A-Za-z][A-Za-z0-9-]*'
-                                r'(\.[A-Za-z][A-Za-z0-9-]*)+$')
+# Even though the RFC does not allow it all-numeric domains do exist
+_DOMAIN_RE = re.compile(r'[^@]{1,64}@[A-Za-z0-9][A-Za-z0-9-]+'
+                                r'(\.[A-Za-z0-9][A-Za-z0-9-]*)+$')
 
 security.declarePublic('checkEmailAddress')
 def checkEmailAddress(address):



More information about the CMF-checkins mailing list