[ckan-dev] ckan-dev Digest, Vol 94, Issue 9

Prashant Gupta p.gupta at auckland.ac.nz
Thu Aug 9 00:01:33 UTC 2018


Hi Adria

I tried the code as you suggested – it somehow went into a recursive loop and kept printing the following in the logs until it crashed:

[Thu Aug 09 11:13:29.956732 2018] [wsgi:error] [pid 18979:tid 139712083015424] 2018-08-09 11:13:29,956 INFO  [ckanext.shibboleth] Creating ShibbolethIdentifierPlugin...
[Thu Aug 09 11:13:29.956995 2018] [wsgi:error] [pid 18979:tid 139712083015424] 2018-08-09 11:13:29,956 INFO  [ckanext.shibboleth] Initting ShibbolethIdentifierPlugin...
[Thu Aug 09 11:13:29.957094 2018] [wsgi:error] [pid 18979:tid 139712083015424] 2018-08-09 11:13:29,957 INFO  [ckanext.shibboleth] Shibboleth auth will be identified by HTTP_SHIB_AUTHENTICATION_METHOD = urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport
[Thu Aug 09 11:13:29.957281 2018] [wsgi:error] [pid 18979:tid 139712083015424] 2018-08-09 11:13:29,957 INFO  [ckan.config.environment] Loading static files from public
[Thu Aug 09 11:13:29.981401 2018] [wsgi:error] [pid 18979:tid 139712083015424] 2018-08-09 11:13:29,981 INFO  [ckan.config.environment] Loading templates from /usr/lib/ckan/default/src/ckan/ckan/templates

Prashant

On 9/08/18, 12:00 AM, "ckan-dev on behalf of ckan-dev-request at lists.okfn.org" <ckan-dev-bounces at lists.okfn.org on behalf of ckan-dev-request at lists.okfn.org> wrote:

    Send ckan-dev mailing list submissions to
    	ckan-dev at lists.okfn.org
    
    To subscribe or unsubscribe via the World Wide Web, visit
    	https://lists.okfn.org/mailman/listinfo/ckan-dev
    or, via email, send a message with subject or body 'help' to
    	ckan-dev-request at lists.okfn.org
    
    You can reach the person managing the list at
    	ckan-dev-owner at lists.okfn.org
    
    When replying, please edit your Subject line so it is more specific
    than "Re: Contents of ckan-dev digest..."
    
    
    Today's Topics:
    
       1. Re: Flask URL generation error (Adri? Mercader)
    
    
    ----------------------------------------------------------------------
    
    Message: 1
    Date: Wed, 8 Aug 2018 13:16:31 +0200
    From: Adri? Mercader <adria.mercader at okfn.org>
    To: CKAN Development Discussions <ckan-dev at lists.okfn.org>
    Subject: Re: [ckan-dev] Flask URL generation error
    Message-ID:
    	<CAGJR8iKg57P41jxrZ_UhzcboBhkXFbUXzyUs8egNLnnqQ+RwfA at mail.gmail.com>
    Content-Type: text/plain; charset="UTF-8"
    
    Hi Prashant,
    
    I'm not familiar with the extension, but the same principle should
    apply. All calls to url_for should be done in the context of a web
    requests. You can create a mock one, but for that you'll need a Flask
    application.
    
    Try something like this and see if it works (untested!):
    
    from ckan.config.middleware import make_app
    
    config = toolkit.config
    app = make_app(config['global_conf'], **config)
    flask_app = app.apps['flask_app']._wsgi_app
    with  flask_app.test_request_context():
        self.login_url = url_for(controller=controller, action='shiblogin')
        self.login_form_url = url_for(controller='user', action='login')
        self.logout_url = url_for(controller='user', action='logout')
    
    On 8 August 2018 at 01:26, Prashant Gupta <p.gupta at auckland.ac.nz> wrote:
    > Hi,
    >
    >
    >
    > I am running an instance of CKAN 2.8.1 on Ubuntu 16.04. I am trying to
    > install ckanext-shibboleth
    > (https://github.com/geosolutions-it/ckanext-shibboleth) but getting the
    > following error:
    >
    >
    >
    > [Wed Aug 08 10:38:42.924435 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483] mod_wsgi (pid=13849): Target
    > WSGI script '/etc/ckan/default/apache.wsgi' cannot be loaded as Python
    > module.
    >
    > [Wed Aug 08 10:38:42.924496 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483] mod_wsgi (pid=13849): Exception
    > occurred processing WSGI script '/etc/ckan/default/apache.wsgi'.
    >
    > [Wed Aug 08 10:38:42.924523 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483] Traceback (most recent call
    > last):
    >
    > [Wed Aug 08 10:38:42.924589 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/etc/ckan/default/apache.wsgi", line 10, in <module>
    >
    > [Wed Aug 08 10:38:42.924628 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     application =
    > loadapp('config:%s' % config_filepath)
    >
    > [Wed Aug 08 10:38:42.924647 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py",
    > line 247, in loadapp
    >
    > [Wed Aug 08 10:38:42.924837 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     return loadobj(APP, uri,
    > name=name, **kw)
    >
    > [Wed Aug 08 10:38:42.924861 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py",
    > line 272, in loadobj
    >
    > [Wed Aug 08 10:38:42.924891 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     return context.create()
    >
    > [Wed Aug 08 10:38:42.924909 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py",
    > line 710, in create
    >
    > [Wed Aug 08 10:38:42.924927 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     return
    > self.object_type.invoke(self)
    >
    > [Wed Aug 08 10:38:42.924947 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/loadwsgi.py",
    > line 146, in invoke
    >
    > [Wed Aug 08 10:38:42.924965 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     return
    > fix_call(context.object, context.global_conf, **context.local_conf)
    >
    > [Wed Aug 08 10:38:42.924976 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/lib/python2.7/site-packages/paste/deploy/util.py",
    > line 55, in fix_call
    >
    > [Wed Aug 08 10:38:42.925000 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     val = callable(*args, **kw)
    >
    > [Wed Aug 08 10:38:42.925084 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/__init__.py", line
    > 58, in make_app
    >
    > [Wed Aug 08 10:38:42.925172 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     **app_conf)
    >
    > [Wed Aug 08 10:38:42.925191 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/pylons_app.py", line
    > 121, in make_pylons_stack
    >
    > [Wed Aug 08 10:38:42.925305 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]
    > who_parser.parse(open(app_conf['who.config_file']))
    >
    > [Wed Aug 08 10:38:42.925325 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/lib/python2.7/site-packages/repoze/who/config.py",
    > line 86, in parse
    >
    > [Wed Aug 08 10:38:42.925357 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     obj =
    > self._makePlugin(name, IPlugin, options)
    >
    > [Wed Aug 08 10:38:42.925375 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/lib/python2.7/site-packages/repoze/who/config.py",
    > line 42, in _makePlugin
    >
    > [Wed Aug 08 10:38:42.925393 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     obj = obj(**options)
    >
    > [Wed Aug 08 10:38:42.925414 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/src/ckanext-shibboleth/ckanext/shibboleth/repoze/ident.py",
    > line 33, in make_identification_plugin
    >
    > [Wed Aug 08 10:38:42.925438 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     return
    > ShibbolethIdentifierPlugin(**kwargs)
    >
    > [Wed Aug 08 10:38:42.925455 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/src/ckanext-shibboleth/ckanext/shibboleth/repoze/ident.py",
    > line 76, in __init__
    >
    > [Wed Aug 08 10:38:42.925477 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     self.login_url =
    > h.url_for(controller=controller, action='shiblogin')
    >
    > [Wed Aug 08 10:38:42.925502 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/src/ckan/ckan/lib/helpers.py", line 318, in url_for
    >
    > [Wed Aug 08 10:38:42.925525 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     my_url =
    > _url_for_flask(*args, **kw)
    >
    > [Wed Aug 08 10:38:42.925550 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/src/ckan/ckan/lib/helpers.py", line 377, in
    > _url_for_flask
    >
    > [Wed Aug 08 10:38:42.925568 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     my_url =
    > _flask_default_url_for(*args, **kw)
    >
    > [Wed Aug 08 10:38:42.925584 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]   File
    > "/usr/lib/ckan/default/lib/python2.7/site-packages/flask/helpers.py", line
    > 270, in url_for
    >
    > [Wed Aug 08 10:38:42.925606 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483]     raise
    > RuntimeError('Attempted to generate a URL without the '
    >
    > [Wed Aug 08 10:38:42.925645 2018] [wsgi:error] [pid 13849:tid
    > 139993845167872] [remote 130.216.158.32:483] RuntimeError: Attempted to
    > generate a URL without the application context being pushed. This has to be
    > executed when application context is available.
    >
    >
    >
    > With a bit of research, I found that this is due to the changes to support
    > url_for for both Flask and Pylons. However, the solution given at
    > https://github.com/ckan/ckan/issues/3083 only tells what we need to do in
    > tests. In my case, this is resulting from a url_for call in ?ident.py?.
    >
    >
    >
    > I would really appreciate any help.
    >
    >
    >
    > Cheers,
    >
    > Prashant
    >
    >
    > _______________________________________________
    > ckan-dev mailing list
    > ckan-dev at lists.okfn.org
    > https://lists.okfn.org/mailman/listinfo/ckan-dev
    > Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
    >
    
    
    ------------------------------
    
    Subject: Digest Footer
    
    _______________________________________________
    ckan-dev mailing list
    ckan-dev at lists.okfn.org
    https://lists.okfn.org/mailman/listinfo/ckan-dev
    Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
    
    
    ------------------------------
    
    End of ckan-dev Digest, Vol 94, Issue 9
    ***************************************
    



More information about the ckan-dev mailing list