When testing with DummyRequest, HTTP_HOST and SERVER_NAME aren't set.
As a result, one of two things needs to happen:

pyramid/authentication.py (line 377)
cur_domain = environ.get('HTTP_HOST', environ.get('SERVER_NAME'))

If cur_domain doesn't find either HTTP_HOST or SERVER_NAME, cur_domain
is set to None which causes a TypeError:

/pyramid/authentication.py", line 388, in _get_cookies
    if ':' in cur_domain:
TypeError: argument of type 'NoneType' is not iterable

One possible workaround in the test code is to set the environment
locally:

environ = {
    'HTTP_HOST':'test.com',
    'SERVER_NAME':'test.com',
}

request = testing.DummyRequest(environ=environ)

However, should testing.setUp set certain variables to a sane default,
perhaps 'localhost' unless overridden? pyramid.paster.bootstrap seems
to properly handle this, but, the pyramid.testing doesn't.

Perhaps a more forgiving default could be used to avoid the exception?
The TypeError as it is could point out incorrectly configured
deployments whereas a default of localhost might cause additional
trouble debugging deployment issues. Or, should the test setUp set a
bare minimum environment and more closely replicate bootstrap's
behavior?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to