Package: formencode
Severity: normal
Tags: patch

Hello,

There is  a problem  with the validators  module in  formencode. Indeed,
when  you   use  the  parameter  'resolve_domain=True'   for  the  Email
validator, it doesn't  work at all when your  DNS server isn't available
or if there is a problem with the socket. It should catch this exception
and raises 'Invalid' exception IMHO.

The traceback :

>>> import formencode
>>> e = formencode.validators.Email(resolve_domain=True)
>>> e.to_python('[EMAIL PROTECTED]')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/site-packages/formencode/api.py", line 319, in 
to_python
    vp(value, state)
  File "/usr/lib/python2.4/site-packages/formencode/validators.py", line 1176, 
in validate_python
    domains = mxlookup(splitted[1])
  File "/var/lib/python-support/python2.4/DNS/lazy.py", line 26, in mxlookup
    a = Base.DnsRequest(name, qtype = 'mx').req().answers
  File "/var/lib/python-support/python2.4/DNS/Base.py", line 173, in req
    self.sendUDPRequest(server)
  File "/var/lib/python-support/python2.4/DNS/Base.py", line 189, in 
sendUDPRequest
    self.conn()
  File "/var/lib/python-support/python2.4/DNS/Base.py", line 137, in conn
    self.s.connect((self.ns,self.port))
  File "<string>", line 1, in connect
socket.error: (101, 'Network is unreachable')

I am using my patch since about two days and it works fine. Feel free to
send me a mail if you need further informations.

Regards,
Arnaud Fontaine

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17.4-maggie
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to