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

ImportError: cannot import name 'available_attrs' from 'django.utils.decorators' #23

Closed
eos-13 opened this issue Mar 17, 2020 · 2 comments

Comments

@eos-13
Copy link

eos-13 commented Mar 17, 2020

Hi

using django 3 I got this error launching migrate command:

File "/home//.virtualenvs//lib/python3.7/site-packages/django/urls/conf.py", line 34, in include urlconf_module = import_module(urlconf_module) File "/usr/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home//.virtualenvs//lib/python3.7/site-packages/sphinxdoc/urls.py", line 7, in <module> from . import views File "/home//.virtualenvs//lib/python3.7/site-packages/sphinxdoc/views.py", line 20, in <module> from sphinxdoc.decorators import user_allowed_for_project File "/home//.virtualenvs//lib/python3.7/site-packages/sphinxdoc/decorators.py", line 7, in <module> from django.utils.decorators import available_attrs ImportError: cannot import name 'available_attrs' from 'django.utils.decorators' (/home//.virtualenvs//lib/python3.7/site-packages/django/utils/decorators.py)

Seems an issue with Django 3 as available_attrs seems not existing anymore. Can you have a look at it ?

@eos-13
Copy link
Author

eos-13 commented Mar 17, 2020

in decorators.py:

change at line 1, 7 (removed) and 18 (don't know how to make a PR)

from functools import wraps, WRAPPER_ASSIGNMENTS

from django.contrib.auth.views import redirect_to_login
from django.core.exceptions import ImproperlyConfigured
from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404

from sphinxdoc.models import Project


def user_allowed_for_project(view_func):
    """
    Check that the user is allowed for the project.

    If the user is not allowed, the view will be redirected to the standard
    login page.
    """
    @wraps(view_func, assigned=WRAPPER_ASSIGNMENTS)
    def _wrapped_view(request, *args, **kwargs):
        functools.WRAPPER_ASSIGNEMENTS
        try

@timobrembeck
Copy link
Collaborator

Hi @eos-13,
thanks for reporting this issue, however I don't really understand how this error is related to this package. Or did you mean it as feature request, in case other people have this error as well? Since no one else did respond to this issue, I'd suggest to close it...
Feel free to add more context information, so I can reconsider this topic.

@timobrembeck timobrembeck closed this as not planned Won't fix, can't repro, duplicate, stale Jan 2, 2023
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

2 participants