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

[multilingual] AttributeError: '_Globals' object has no attribute 'fields' #4338

Open
saper opened this issue Jul 16, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@saper
Copy link

commented Jul 16, 2018

CKAN Version if known (or site URL)

2.8.0

Please describe the expected behaviour

The site should load.

Please describe the actual behaviour

After uploading a first data set, the site became unavailable.

During restart, the following exception is generated:

2018-07-16 10:14:55,940 DEBUG [pysolr] Found '1' search results.
[2018-07-16 10:14:55,944] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/home/ckan/ckan/ckan/views/home.py", line 64, in index
    return base.render(u'home/index.html', extra_vars={})
  File "/usr/home/ckan/ckan/ckan/lib/base.py", line 127, in render
    return flask_render_template(template_name, **extra_vars)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/templating.py", line 134, in render_template
    context, ctx.app)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/templating.py", line 116, in _render
    rv = template.render(context)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/home/ckan/ckan/ckan/templates/home/index.html", line 2, in top-level template code
    {% set homepage_style = ( g.homepage_style or '1' ) %}
  File "/usr/home/ckan/ckan/ckan/templates/page.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/usr/home/ckan/ckan/ckan/templates/base.html", line 101, in top-level template code
    {%- block page %}{% endblock -%}
  File "/usr/home/ckan/ckan/ckan/templates/page.html", line 19, in block "page"
    {%- block content %}
  File "/usr/home/ckan/ckan/ckan/templates/home/index.html", line 14, in block "content"
    {% block primary_content %}
  File "/usr/home/ckan/ckan/ckan/templates/home/index.html", line 15, in block "primary_content"
    {% snippet "home/layout{0}.html".format(homepage_style) %}
  File "/usr/home/ckan/ckan/ckan/lib/jinja_extensions.py", line 268, in _call
    return base.render_snippet(args[0], **kwargs)
  File "/usr/home/ckan/ckan/ckan/lib/base.py", line 84, in render_snippet
    output = render(template_name, extra_vars=kw)
  File "/usr/home/ckan/ckan/ckan/lib/base.py", line 127, in render
    return flask_render_template(template_name, **extra_vars)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/templating.py", line 134, in render_template
    context, ctx.app)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/templating.py", line 116, in _render
    rv = template.render(context)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/home/ckan/ckan/ckan/templates/home/layout2.html", line 29, in top-level template code
    {% block featured_group %}
  File "/usr/home/ckan/ckan/ckan/templates/home/layout2.html", line 30, in block "featured_group"
    {% snippet 'home/snippets/featured_group.html' %}
  File "/usr/home/ckan/ckan/ckan/lib/jinja_extensions.py", line 268, in _call
    return base.render_snippet(args[0], **kwargs)
  File "/usr/home/ckan/ckan/ckan/lib/base.py", line 84, in render_snippet
    output = render(template_name, extra_vars=kw)
  File "/usr/home/ckan/ckan/ckan/lib/base.py", line 127, in render
    return flask_render_template(template_name, **extra_vars)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/templating.py", line 134, in render_template
    context, ctx.app)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/templating.py", line 116, in _render
    rv = template.render(context)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/home/ckan/ckan/ckan/templates/home/snippets/featured_group.html", line 1, in top-level template code
    {% set groups = h.get_featured_groups() %}
  File "/usr/home/ckan/ckan/ckan/lib/helpers.py", line 2413, in get_featured_groups
    items=config_groups)
  File "/usr/home/ckan/ckan/ckan/lib/helpers.py", line 2439, in featured_group_org
    group = get_group(group_name)
  File "/usr/home/ckan/ckan/ckan/lib/helpers.py", line 2427, in get_group
    out = logic.get_action(get_action)(context, data_dict)
  File "/usr/home/ckan/ckan/ckan/logic/__init__.py", line 464, in wrapped
    result = _action(context, data_dict, **kw)
  File "/usr/home/ckan/ckan/ckan/logic/action/get.py", line 1281, in group_show
    return _group_or_org_show(context, data_dict)
  File "/usr/home/ckan/ckan/ckan/logic/action/get.py", line 1215, in _group_or_org_show
    include_users=include_users,)
  File "/usr/home/ckan/ckan/ckan/lib/dictization/model_dictize.py", line 407, in group_dictize
    package_count, packages = get_packages_for_this_group(group)
  File "/usr/home/ckan/ckan/ckan/lib/dictization/model_dictize.py", line 403, in get_packages_for_this_group
    q)
  File "/usr/home/ckan/ckan/ckan/logic/__init__.py", line 464, in wrapped
    result = _action(context, data_dict, **kw)
  File "/usr/home/ckan/ckan/ckan/logic/action/get.py", line 1884, in package_search
    package_dict = item.before_view(package_dict)
  File "/usr/home/ckan/ckan/ckanext/multilingual/plugin.py", line 338, in before_view
    terms = [value for param, value in c.fields]
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/werkzeug/local.py", line 347, in __getattr__
    return getattr(self._get_current_object(), name)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/werkzeug/local.py", line 347, in __getattr__
    return getattr(self._get_current_object(), name)
  File "/usr/home/ckan/ckan/ckan/config/middleware/flask_app.py", line 334, in __getattr__
    return getattr(app_globals.app_globals, name)
AttributeError: '_Globals' object has no attribute 'fields'
----------------------------------------
Exception happened during processing of request from ('172.17.20.12', 17729)
Traceback (most recent call last):
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/paste/httpserver.py", line 1068, in process_request_in_thread
    self.finish_request(request, client_address)
  File "/usr/local/lib/python2.7/SocketServer.py", line 331, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/local/lib/python2.7/SocketServer.py", line 652, in __init__
    self.handle()
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/paste/httpserver.py", line 442, in handle
    BaseHTTPRequestHandler.handle(self)
  File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 340, in handle
    self.handle_one_request()
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/paste/httpserver.py", line 437, in handle_one_request
    self.wsgi_execute()
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/paste/httpserver.py", line 287, in wsgi_execute
    self.wsgi_start_response)
  File "/usr/home/ckan/ckan/ckan/config/middleware/__init__.py", line 202, in __call__
    return self.apps[app_name](environ, start_response)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/repoze/who/middleware.py", line 86, in __call__
    app_iter = app(environ, wrapper.wrap_start_response)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/fanstatic/publisher.py", line 234, in __call__
    return request.get_response(self.app)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/webob/dec.py", line 147, in __call__
    resp = self.call_func(req, *args, **self.kwargs)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/webob/dec.py", line 208, in call_func
    return self.func(req, *args, **kwargs)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/fanstatic/injector.py", line 54, in __call__
    response = request.get_response(self.app)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/webob/request.py", line 1053, in get_response
    application, catch_exc_info=False)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/webob/request.py", line 1022, in call_application
    app_iter = application(self.environ, start_response)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/beaker/middleware.py", line 156, in __call__
    return self.wrap_app(environ, session_start_response)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/home/ckan/ukraine/lib/python2.7/site-packages/flask/app.py", line 1547, in handle_exception
    return self.finalize_request(handler(e), from_error_handler=True)
  File "/usr/home/ckan/ckan/ckan/config/middleware/flask_app.py", line 411, in error_handler
    extra_vars = {u'code': e.code, u'content': e.description}
AttributeError: 'exceptions.AttributeError' object has no attribute 'code'

What steps can be taken to reproduce the issue?

New CKAN site,

8 organizations

1st data set added with a simple JSON file

@saper

This comment has been minimized.

Copy link
Author

commented Jul 16, 2018

I have disabled all multilingual plugins as a workaround.

@torfsen

This comment has been minimized.

Copy link
Contributor

commented Jul 17, 2018

I don't know about the first traceback (AttributeError: '_Globals' object has no attribute 'fields'), but the second issue (AttributeError: 'exceptions.AttributeError' object has no attribute 'code') has already been fixed in 396973e. That fix hasn't been released, yet, however.

@saper

This comment has been minimized.

Copy link
Author

commented Jul 18, 2018

Thanks @torfsen - yes, I had a look at it and considered it merely a mild annoyance, didn't even bother to file it. Thanks for fixing it so quickly.

@jeverling

This comment has been minimized.

Copy link

commented Nov 8, 2018

I see the first error you mention, AttributeError: '_Globals' object has no attribute 'fields', only when I have the hierarchy extension enabled, specifically the error doesn't appear when I disable hierarchy_display. This problem didn't exist in 2.7.2 which I was using before.
Do you use this extension by any change?

@jeverling

This comment has been minimized.

Copy link

commented Nov 8, 2018

There is an open issue on ckanext-hierarchy: datagovuk/ckanext-hierarchy#25

It works for me when installing the fork. Your problem might have been unrelated but at least I saw exactly the same error message.

@saper

This comment has been minimized.

Copy link
Author

commented Nov 8, 2018

@jeverling nope, I don't have hierarchy extension installed, it was coming only with multilingual extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.