#15337 closed (worksforme)
cyclic import dependency when extend builtin backend — at Version 1
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Core (Cache system) | Version: | 1.3-beta |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description (last modified by )
When writing a custom cache backend which inherit from django's builtin memcache backend, say mycache.py:
from django.core.cache.backends.memcached import CacheClass as BaseCacheClass
class MyCache(BaseCacheClass):
....
and set backend to "mycache.MyCache" in settings.py, then mycache.py and django.core.cache.__init__.py import each other.
Turn django.core.cache.__init__.py::cache object to be a SimpleLazyObject would solve this problem.
Change History (2)
by , 15 years ago
| Attachment: | cache.patch added |
|---|
comment:1 by , 15 years ago
| Description: | modified (diff) |
|---|---|
| Resolution: | → worksforme |
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Can't reproduce -- I dropped a custom cache class defined as you describe, and don't the problem you describe. Looking at the code, I can't even work out what set of conditions would allow this to be reproduced -- I don't see any circular dependency. memcached doesn't import anything from the django.core.cache.