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: No module named deconstruct #54

Closed
omarali opened this issue Oct 7, 2016 · 2 comments
Closed

ImportError: No module named deconstruct #54

omarali opened this issue Oct 7, 2016 · 2 comments

Comments

@omarali
Copy link
Contributor

omarali commented Oct 7, 2016

This error happens with django versions older than 1.7 (https://docs.djangoproject.com/en/1.10/releases/1.7/#new-method-on-field-subclasses).

>>> import swift.storage
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/swift/storage.py", line 11, in <module>
    from django.utils.deconstruct import deconstructible
ImportError: No module named deconstruct
>>> import django
>>> django.VERSION
(1, 6, 11, 'final', 0)

One solution is to use an identity decorator if django.utils.deconstruct cannot be imported to maximize support across as many django versions as possible.

-from django.utils.deconstruct import deconstructible
+try:
+   from django.utils.deconstruct import deconstructible
+except ImportError:
+   def deconstructible(arg):
+      return arg
@einarf
Copy link
Contributor

einarf commented Nov 5, 2016

I guess the best way is to make a PR with a suggested solution. I'm not entirely sure what Django version this project aims to support, but looking at the recently created tests it seems that django 1.9 and 1.10 is the main focus. (aka. currently supported versions by the django project)

@omarali
Copy link
Contributor Author

omarali commented Dec 28, 2016

Opened PR #71.

@omarali omarali closed this as completed Jan 9, 2017
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