#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)
-------------------- 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'
#base_config.sa_auth.group_class = model.Group
#base_config.sa_auth.permission_class = model.Permission# If no identifiers are provided in repoze setup arguments
# then create a default one using AuthTktCookiePlugin.
if 'identifiers' not in who_args:
from repoze.who.plugins.auth_tkt import AuthTktCookiePlugin
cookie = AuthTktCookiePlugin(cookie_secret, cookie_name,
timeout=cookie_timeout,
reissue_time=cookie_reissue_time)
who_args['identifiers'] = [('cookie', cookie)]
#who_args['authenticators'].insert(0, ('cookie', cookie))
# If no form plugin is provided then create a default
# one using the provided options.
Can anyone please confirm this so that I'm not inadvertently crippling something?
Juraj