Skip to content
This repository has been archived by the owner on Oct 29, 2019. It is now read-only.

'WSGIRequest' object has no attribute 'toolbar' #453

Closed
DustinHolden opened this issue May 3, 2017 · 1 comment
Closed

'WSGIRequest' object has no attribute 'toolbar' #453

DustinHolden opened this issue May 3, 2017 · 1 comment

Comments

@DustinHolden
Copy link

Getting an AttributeError when trying to view published articles and not logged in.

Django Version: 1.8.18
Python Version: 3.5.2
Aldryn Newsblog Version 1.3.2

Traceback shows it failing in views.py for:

class EditModeMixin(object):
    """
    A mixin which sets the property 'edit_mode' with the truth value for
    whether a user is logged-into the CMS and is in edit-mode.
    """
    edit_mode = False

    def dispatch(self, request, *args, **kwargs):
        self.edit_mode = (
            self.request.toolbar and self.request.toolbar.edit_mode)

        return super(EditModeMixin, self).dispatch(request, *args, **kwargs)

I was able to patch mine by adding a check for the 'toolbar' attribute.

    def dispatch(self, request, *args, **kwargs):
        if hasattr(request, 'toolbar'):
            self.edit_mode = (
                self.request.toolbar and self.request.toolbar.edit_mode)
@DustinHolden
Copy link
Author

Closed. @mkoistinen has already made a pull request with a fix for this in #351.

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

No branches or pull requests

1 participant