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

fix an import loop in services (bug 1055654) #219

Merged
merged 1 commit into from
Aug 19, 2014

Conversation

magopian
Copy link
Contributor

Stack trace of the issue (introduced in 986d867)

[magopian@dev1.addons.phx1 olympia]$ ../venv/bin/python services/wsgi/versioncheck.py
Traceback (most recent call last):
  File "services/wsgi/versioncheck.py", line 14, in <module>
    from update import application
  File "/data/addons-dev/www/addons-dev.allizom.org/deploy-olympia-dev-20140819092755-8ce8dd365c/olympia/services/update.py", line 25, in <module>
    from utils import (APP_GUIDS, get_mirror, log_configure, PLATFORMS,
  File "/data/addons-dev/www/addons-dev.allizom.org/deploy-olympia-dev-20140819092755-8ce8dd365c/olympia/services/utils.py", line 38, in <module>
    from amo.helpers import user_media_url
  File "/data/addons-dev/www/addons-dev.allizom.org/deploy-olympia-dev-20140819092755-8ce8dd365c/olympia/apps/amo/__init__.py", line 7, in <module>
    from caching.base import CachingQuerySet
  File "/data/addons-dev/www/addons-dev.allizom.org/deploy-olympia-dev-20140819092755-8ce8dd365c/venv/src/django-cache-machine/caching/base.py", line 10, in <module>
    from .compat import DEFAULT_TIMEOUT, FOREVER
  File "/data/addons-dev/www/addons-dev.allizom.org/deploy-olympia-dev-20140819092755-8ce8dd365c/venv/src/django-cache-machine/caching/compat.py", line 7, in <module>
    from django.core.cache.backends.base import DEFAULT_TIMEOUT as DJANGO_DEFAULT_TIMEOUT
  File "/data/addons-dev/www/addons-dev.allizom.org/deploy-olympia-dev-20140819092755-8ce8dd365c/venv/lib/python2.6/site-packages/django/core/cache/__init__.py", line 138, in <module>
    cache = get_cache(DEFAULT_CACHE_ALIAS)
  File "/data/addons-dev/www/addons-dev.allizom.org/deploy-olympia-dev-20140819092755-8ce8dd365c/venv/lib/python2.6/site-packages/django/core/cache/__init__.py", line 130, in get_cache
    "Could not find backend '%s': %s" % (backend, e))
django.core.cache.backends.base.InvalidCacheBackendError: Could not find backend 'caching.backends.memcached.MemcachedCache': Error importing module caching.backends.memcached: "cannot import name DEFAULT_TIMEOUT"

@magopian magopian changed the title fix an import loop in services fix an import loop in services (bug 1055654) Aug 19, 2014
@diox
Copy link
Member

diox commented Aug 19, 2014

r+ we should file a follow-up bug to make this DRY (maybe we don't have to avoid the imports, maybe we do and we can find another file for this function to live in, etc)

@diox
Copy link
Member

diox commented Aug 19, 2014

copy/paste from IRC: this appears to be covered by ./apps/addons/tests/test_update.py tests (and it passes - fails if I tweak the copy of the get_user_media implementation)

magopian added a commit that referenced this pull request Aug 19, 2014
fix an import loop in services (bug 1055654)
@magopian magopian merged commit a420373 into mozilla:master Aug 19, 2014
# This is not DRY: it's a copy of amo.helpers.user_media_url, to avoid an
# import (which should be avoided, according to the comments above, and which
# triggers an import loop).
# See bug 1055654.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be interesting to put a comment on amo.helpers.user_media_url too? Only if we can't get rid of that one later.

@magopian magopian deleted the fix-services-utils branch August 19, 2014 20:00
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

Successfully merging this pull request may close these issues.

3 participants