Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'Blueprint' object has no attribute 'before_app_first_request'. Did you mean: 'before_app_request'? #141

Open
fabas-mpcdf opened this issue Mar 7, 2025 · 0 comments
Labels

Comments

@fabas-mpcdf
Copy link

Hi!

I updated ckanext-ldap to version 3.3.3, and now it seems that a Flask blueprint object is not working.
Any time I run a ckan command, for example

# ckan -c /etc/ckan/default/ckan.ini

I get this error:

2025-03-07 10:40:36,766 INFO  [ckan.cli] Using configuration file /etc/ckan/default/ckan.ini
2025-03-07 10:40:36,767 INFO  [ckan.config.environment] Loading static files from public
Traceback (most recent call last):
  File "/usr/lib/ckan/default/bin/ckan", line 8, in <module>
    sys.exit(ckan())
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 1077, in main
    with self.make_context(prog_name, args, **extra) as ctx:
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 943, in make_context
    self.parse_args(ctx, args)
  File "/usr/lib/ckan/default/src/ckan/ckan/cli/cli.py", line 120, in parse_args
    result = super().parse_args(ctx, args)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 1644, in parse_args
    rest = super().parse_args(ctx, args)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 1408, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 2400, in handle_parse_result
    value = self.process_value(ctx, value)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/click/core.py", line 2362, in process_value
    value = self.callback(ctx, self, value)
  File "/usr/lib/ckan/default/src/ckan/ckan/cli/cli.py", line 130, in _init_ckan_config
    _add_ctx_object(ctx, value)
  File "/usr/lib/ckan/default/src/ckan/ckan/cli/cli.py", line 139, in _add_ctx_object
    ctx.obj = CtxObject(path)
  File "/usr/lib/ckan/default/src/ckan/ckan/cli/cli.py", line 56, in __init__
    self.app = make_app(raw_config)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware/__init__.py", line 29, in make_app
    load_environment(conf)
  File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 68, in load_environment
    p.load_all()
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 148, in load_all
    load(*plugins)
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 164, in load
    service = _get_service(plugin)
  File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 284, in _get_service
    return plugin.load()(name=plugin_name)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2465, in load
    return self.resolve()
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/pkg_resources/__init__.py", line 2471, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/ckanext/ldap/plugin.py", line 12, in <module>
    from ckanext.ldap import cli, routes
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/ckanext/ldap/routes/__init__.py", line 7, in <module>
    from . import login
  File "/usr/lib/ckan/default/lib/python3.10/site-packages/ckanext/ldap/routes/login.py", line 20, in <module>
    @blueprint.before_app_first_request
AttributeError: 'Blueprint' object has no attribute 'before_app_first_request'. Did you mean: 'before_app_request'?

Your Setup

  • CKAN version: 2.11.2
  • Commit/version of this repo: 3.3.3
  • Browser (if relevant): Firefox
  • OS: Ubuntu 22.04
@fabas-mpcdf fabas-mpcdf added the bug label Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant