Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Configuration of sessions based on url no longer works #14

Closed
jayd3e opened this Issue · 2 comments

2 participants

@jayd3e

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/channel.py", line 329, in service
    task.service()
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/waitress/task.py", line 173, in service
    self.execute()
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/waitress/task.py", line 380, in execute
    app_iter = self.channel.server.application(env, start_response)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/router.py", line 251, in __call__
    response = self.invoke_subrequest(request, use_tweens=True)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/router.py", line 227, in invoke_subrequest
    response = handle_request(request)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/tweens.py", line 21, in excview_tween
    response = handler(request)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid_tm/__init__.py", line 50, in tm_tween
    userid = unauthenticated_userid(request)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/security.py", line 89, in unauthenticated_userid
    return policy.unauthenticated_userid(request)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/authentication.py", line 1040, in unauthenticated_userid
    return request.session.get(self.userid_key)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/decorator.py", line 39, in __get__
    val = self.wrapped(inst)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/pyramid/request.py", line 350, in session
    return factory(self)
  File "/opt/webapp/clusterflunk/src/pyramid-redis-sessions/pyramid_redis_sessions/__init__.py", line 172, in factory
    redis = get_default_connection(request, url=url, **redis_options)
  File "/opt/webapp/clusterflunk/src/pyramid-redis-sessions/pyramid_redis_sessions/connection.py", line 81, in get_default_connection
    redis = redis_client.from_url(url, **redis_options)
  File "/opt/webapp/clusterflunk/lib/python2.7/site-packages/redis/client.py", line 264, in from_url
    password=url.password, **kwargs)
TypeError: type object got multiple values for keyword argument 'password'
@ericrasmussen

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.

@ericrasmussen

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
Something went wrong with that request. Please try again.