mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 12:49:24 +01:00
Added emailRe to utils.net.
This commit is contained in:
parent
641c5cd634
commit
65893c8e3c
@ -31,8 +31,13 @@
|
|||||||
Simple utility modules.
|
Simple utility modules.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import re
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
emailRe = re.compile(r"^(\w&.+-]+!)*[\w&.+-]+@"
|
||||||
|
r"(([0-9a-z]([0-9a-z-]*[0-9a-z])?\.)[a-z]{2,6}|"
|
||||||
|
r"([0-9]{1,3}\.){3}[0-9]{1,3})$", re.I)
|
||||||
|
|
||||||
def getSocket(host):
|
def getSocket(host):
|
||||||
"""Returns a socket of the correct AF_INET type (v4 or v6) in order to
|
"""Returns a socket of the correct AF_INET type (v4 or v6) in order to
|
||||||
communicate with host.
|
communicate with host.
|
||||||
|
@ -385,6 +385,10 @@ class FileTest(SupyTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class NetTest(SupyTestCase):
|
class NetTest(SupyTestCase):
|
||||||
|
def testEmailRe(self):
|
||||||
|
emailRe = utils.net.emailRe
|
||||||
|
self.failUnless(emailRe.match('jemfinch@supybot.com'))
|
||||||
|
|
||||||
def testIsIP(self):
|
def testIsIP(self):
|
||||||
isIP = utils.net.isIP
|
isIP = utils.net.isIP
|
||||||
self.failIf(isIP('a.b.c'))
|
self.failIf(isIP('a.b.c'))
|
||||||
|
Loading…
Reference in New Issue
Block a user