Help with Regular Expressions matching

Jp Calderone exarkun at intarweb.us
Fri Jan 31 11:04:49 EST 2003


On Fri, Jan 31, 2003 at 12:56:53PM +0530, ajit k jena wrote:
> 
> Hi,
> 
> I have the following requirement:
> 
> 	I have a mailman mailing list. This is a public list where
> 	anyone can post without joining the list. But now I wish to
> 	restrict the posters to a particular set. In particular, what
> 	I want is to allow email addresses of the form:
> 
> 		user at mydomain.name
> 		user at subdomain.mydomain.name
> 
> 	I wish to disallow all other addresses.
> 

    allowedDomains = ('mydomain.name', 'subdomain.mydomain.name')
    for d in allowedDomains:
      if email.endswith('@' + d):
        break
    else:
      raise ValueError, "address not allowed"


  Jp

-- 
C/C++/Java/Perl/Python/Smalltalk/PHP/ASP/XML/Linux (User+Admin)
Genetic Algorithms/Genetic Programming/Neural Networks
Networking/Multithreading/Legacy Code Maintenance/OpenGL
See my complete resume at http://intarweb.us:8080/
-- 
 up 46 days, 7:49, 5 users, load average: 0.55, 0.34, 0.16
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20030131/db76305e/attachment.sig>


More information about the Python-list mailing list