Hi, added straight-from-the-manual ApplicationAuthMetadata to my app_cfg.py:
#This tells to TurboGears how to retrieve the data for your user
>
> class ApplicationAuthMetadata(TGAuthMetadata):
>
> def __init__(self, sa_auth):
>
> self.sa_auth = sa_auth
>
> def get_user(self, identity, userid):
>
> return
> self.sa_auth.dbsession.query(self.sa_auth.user_class).filter_by(user_name=userid).first()
>
> def get_groups(self, identity, userid):
>
> return [g.group_name for g in identity['user'].groups]
>
> def get_permissions(self, identity, userid):
>
> return [p.permission_name for p in identity['user'].permissions]
>
>
> base_config.sa_auth.authmetadata =
> ApplicationAuthMetadata(base_config.sa_auth)
>
>
and immediately got exception below. If I comment out the
base_config.sa_auth.authmetadata setting, all works normally.
TIA,
Juraj
-------------------- Restarting --------------------
> Traceback (most recent call last):
> File "/home/juro/work/coinbr/tg2env/bin/paster", line 8, in <module>
> load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/command.py",
>
> line 104, in run
> invoke(command, command_name, options, args[1:])
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/command.py",
>
> line 143, in invoke
> exit_code = runner.run(args)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/command.py",
>
> line 238, in run
> result = self.command()
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/serve.py",
>
> line 284, in command
> relative_to=base, global_conf=vars)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteScript-1.7.5-py2.7.egg/paste/script/serve.py",
>
> line 321, in loadapp
> **kw)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
>
> line 247, in loadapp
> return loadobj(APP, uri, name=name, **kw)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
>
> line 272, in loadobj
> return context.create()
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
>
> line 710, in create
> return self.object_type.invoke(self)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/loadwsgi.py",
>
> line 146, in invoke
> return fix_call(context.object, context.global_conf,
> **context.local_conf)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py",
>
> line 59, in fix_call
> reraise(*exc_info)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/compat.py",
>
> line 22, in reraise
> exec('raise t, e, tb', dict(t=t, e=e, tb=tb))
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/PasteDeploy-1.5.0-py2.7.egg/paste/deploy/util.py",
>
> line 56, in fix_call
> val = callable(*args, **kw)
> File
> "/home/juro/work/coinbr/tg2env/Coin-Broker/coinbr/config/middleware.py",
> line 35, in make_app
> app = make_base_app(global_conf, full_stack=True, **app_conf)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/TurboGears2-2.2.0-py2.7.egg/tg/configuration/app_config.py",
>
> line 962, in make_base_app
> app = self.add_auth_middleware(app, skip_authentication)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/TurboGears2-2.2.0-py2.7.egg/tg/configuration/app_config.py",
>
> line 721, in add_auth_middleware
> app = setup_auth(app, skip_authentication=skip_authentication,
> **auth_args)
> File
> "/home/juro/work/coinbr/tg2env/lib/python2.7/site-packages/TurboGears2-2.2.0-py2.7.egg/tg/configuration/auth.py",
>
> line 229, in setup_auth
> return PluggableAuthenticationMiddleware(app, **who_args)
> TypeError: __init__() got an unexpected keyword argument 'permission_class'
>
>
--
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/turbogears/-/XYk_pIT_Jk4J.
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/turbogears?hl=en.