电缆塔和AuthKit OpenID问题

2024-05-05 04:08:07 发布

您现在位置:Python中文网/ 问答频道 /正文

我在使用authkit和pylons设置对openID身份验证的支持时遇到了困难。 我按照cookbook中的描述设置了所有内容,但仍然出现以下错误:

  File "/usr/lib/python2.6/dist-packages/authkit/authenticate/open_id.py", line 480, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/python2.6/dist-packages/authkit/authenticate/open_id.py", line 218, in __call__
    self.session_middleware
AuthKitConfigError: The session middleware 'beaker.session' is not present. Have you set up the session middleware?

(完整的回溯是不具信息性的,只是一系列中间件调用)

我的配置如下:

^{pr2}$

烧杯中间件肯定已经加载,这里是我的make_app函数(是的,pylons版本检查是真的):

|       # Configure the Pylons environment
|       load_environment(global_conf, app_conf)
|   
|       # The Pylons WSGI app
|       app = PylonsApp()
|       app = UserMiddleware(app)
|   
|       if pylons.__version__ >= "0.9.7":
|-          from beaker.middleware import SessionMiddleware
||          from routes.middleware import RoutesMiddleware
||          app = RoutesMiddleware(app, config['routes.map'])
||          app = SessionMiddleware(app, app_conf)
|   
|   
|       if asbool(full_stack):                                                                                                                               
|           # Handle Python exceptions
|   
|-          app = authkit.authenticate.middleware(app, app_conf)
||          # Display error documents for 401, 403, 404 status codes (and
||          # 500 when debug is disabled)
||          if pylons.__version__ >= "0.9.7":
||-             app = ErrorHandler(app, global_conf,
23-                            **config['pylons.errorware'])
|||             from pylons.middleware import StatusCodeRedirect
|||             if asbool(config['debug']):
23-                 app = StatusCodeRedirect(app)
|||             else:
23-                 app = StatusCodeRedirect(app, [401, 403, 404, 500])
||          else:
||-             app = ErrorHandler(app, global_conf, error_template = error_template,
23-                            **config['pylons.errorware'])
|||             app = ErrorDocuments(app, global_conf, mapper=error_mapper, **app_conf)
|   
|       # Establish the Registry for this application
|       app = RegistryManager(app)
|   
|       # Static files
|       javascripts_app = StaticJavascripts()
|       static_app = StaticURLParser(config['pylons.paths']['static_files'])
|       app = Cascade([static_app, javascripts_app, app])
|       return app

有人知道这是怎么回事吗?在


Tags: thefromimportconfigappifsessionconf