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

Upgraded from 3.1 to 3.1.1 & I'm getting an AttributeError from the toolbar #4219

Closed
marksweb opened this issue Jun 29, 2015 · 5 comments
Closed

Comments

@marksweb
Copy link
Sponsor Member

I've just upgraded a project to 3.1.1, cleaned pyc files, migrated & tried to load a page. This has resulted in an AttributeError;

File "/Users/mwalker/Sites/proj/lib/python2.7/site-packages/django/template/debug.py", line 90, in render
output = self.filter_expression.resolve(context)
File "/Users/mwalker/Sites/proj/lib/python2.7/site-packages/django/template/base.py", line 596, in resolve
obj = self.var.resolve(context)
File "/Users/mwalker/Sites/proj/lib/python2.7/site-packages/django/template/base.py", line 734, in resolve
value = self._resolve_lookup(context)
File "/Users/mwalker/Sites/proj/lib/python2.7/site-packages/django/template/base.py", line 788, in _resolve_lookup
current = current()
File "/Users/mwalker/Sites/proj/lib/python2.7/site-packages/cms/toolbar/toolbar.py", line 231, in get_object_public_url
with force_language(self.request.LANGUAGE_CODE):

AttributeError: 'WSGIRequest' object has no attribute 'LANGUAGE_CODE'
@aa-dit-yuh
Copy link

I faced the same problem.
Please ensure that you have 'django.middleware.locale.LocaleMiddleware' included in `MIDDLEWARE_CLASSES``.

@marksweb
Copy link
Sponsor Member Author

Nice, thanks @narayanaditya95 totally missed the fact that was missing!

@oliwarner
Copy link

Why is django.middleware.locale.LocaleMiddleware a requirement now? Kick it out, the code should fall back to settings.LANGUAGE_CODE (or self.language in that code, or something in between).

Please reopen and fix this.

@yakky
Copy link
Member

yakky commented Aug 21, 2015

django CMS needs the language in the request for a lot of things and thus needs LocaleMiddleware; this requirement won't go away

@oliwarner
Copy link

It didn't though. Barely a minor version ago cms/toolbar/toolbar.py was fine falling back on the settings as the default language. What has happened recently that makes this behaviour impossible or impractical?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants