Skip to content

Account for a cached value of False when validating.#31

Open
dmpayton wants to merge 1 commit into
mailgun:masterfrom
dmpayton:master
Open

Account for a cached value of False when validating.#31
dmpayton wants to merge 1 commit into
mailgun:masterfrom
dmpayton:master

Conversation

@dmpayton
Copy link
Copy Markdown

Hi there,

I had an issue on django-flanker that I've traced to flanker itself.

dmpayton/django-flanker#2

If connect_to_mail_exchanger throws an exception or fails to connect for whatever, it returns None and mail_exchanger_lookup will set mx_cache[domain] to False.

This is not accounted for on subsequent calls to validate_address. If the cached value is None, it returns None, otherwise it continues. If the cached value is False, it throws the following exception:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/derek/dev/django-flanker/flanker/utils.py", line 99, in wrapper
    return_value = f(*args, **kwargs)
  File "/home/derek/dev/django-flanker/flanker/addresslib/address.py", line 205, in validate_address
    plugin = flanker.addresslib.validate.plugin_for_esp(exchanger)
  File "/home/derek/dev/django-flanker/flanker/addresslib/validate.py", line 108, in plugin_for_esp
    if grammar[0].match(mail_exchanger):
TypeError: expected string or buffer

This patch simply returns None if the cached value is False.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant