Opened 14 years ago
Closed 14 years ago
#17256 closed Bug (fixed)
ContentTypeManager.get_by_natural_key method doesn't cache
| Reported by: | defaultwombat | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.contenttypes | Version: | 1.3 |
| Severity: | Normal | Keywords: | cache contenttypes |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
django.contrib.contenttypes.models.py
ContentTypeManager.get_by_natural_key
Code highlighting:
def get_by_natural_key(self, app_label, model): try: ct = self.__class__._cache[self.db][(app_label, model)] except KeyError: ct = self.get(app_label=app_label, model=model) return ct
If the content_type is not in the cache yet, the method uses get() without adding the result to the cache.
I cannot see how #16042 could be solved without fixing this.
Attachments (3)
Change History (10)
by , 14 years ago
| Attachment: | 17107.patch added |
|---|
comment:1 by , 14 years ago
| Needs tests: | set |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
by , 14 years ago
comment:3 by , 14 years ago
comment:4 by , 14 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
follow-up: 7 comment:6 by , 14 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
| Version: | SVN → 1.3 |
Any chance for this fix to be backported in 1.3.X?
comment:7 by , 14 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Note:
See TracTickets
for help on using tickets.
patch for svn r17107