Configuration of sessions based on url no longer works #14

jayd3e opened this Issue Mar 22, 2013 · 2 comments


None yet

2 participants

jayd3e commented Mar 22, 2013

If you use the redis.url config settings. The options for the connection defaulted here are in turn passed into here throwing this traceback:

2013-03-22 10:20:52,628 ERROR [waitress][Dummy-2] Exception when serving /favicon.ico
Traceback (most recent call last):
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/waitress/", line 329, in service
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/waitress/", line 173, in service
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/waitress/", line 380, in execute
    app_iter =, start_response)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/", line 251, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/", line 227, in invoke_subrequest
    response = handle_request(request)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/", line 21, in excview_tween
    response = handler(request)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid_tm/", line 50, in tm_tween
    userid = unauthenticated_userid(request)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/", line 89, in unauthenticated_userid
    return policy.unauthenticated_userid(request)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/", line 1040, in unauthenticated_userid
    return request.session.get(self.userid_key)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/", line 39, in __get__
    val = self.wrapped(inst)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/", line 350, in session
    return factory(self)
  File "/opt/webapp/clusterflunk/src/pyramid-redis-sessions/pyramid_redis_sessions/", line 172, in factory
    redis = get_default_connection(request, url=url, **redis_options)
  File "/opt/webapp/clusterflunk/src/pyramid-redis-sessions/pyramid_redis_sessions/", line 81, in get_default_connection
    redis = redis_client.from_url(url, **redis_options)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/redis/", line 264, in from_url
    password=url.password, **kwargs)
TypeError: type object got multiple values for keyword argument 'password'

Hey jayd3e, it looks like maybe you have redis.sessions.password set both explicitly and in the URL so it's duplicated. This is actually correct behavior. In the previous feature branch it didn't allow you to pass extra settings to StrictRedis.from_url so you wouldn't have seen the exception, but it also meant you couldn't use other configuration options like charset, socket_timeout, etc.

Can you let me know if removing the duplicate settings works for you? And before I make the next pypi release I will add a patch to check for duplicate settings and raise a clearer ConfigurationError.


OK, I took another look at this and decided to pop the duplicate settings from the options. Since I have defaults for some of those settings and since the docs already say the URL will get priority for those settings, this seems to be the cleanest solution. I also added a new test case to verify the duplicates will be removed when using from_url. I'm closing this for now but let me know if it does raise any other issues. Thanks again!

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