﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
1548	Caching of related objects can be improved	Ned Batchelder (ned@…	Adrian Holovaty	"This is an improvement to related object caching on the trunk.

Explanation:

When using getters, an object attribute is used to cache the result so the database is not consulted on a subsequent call.  For example:

{{{
   c.get_poll()  # Hits the db
   c.get_poll()  # doesn't, reads the cache attribute
}}}

When getting a list of related objects, no record is made of the object that spanwed them:

{{{
   c = p.get_choice_list()
   c.get_poll()  # Hits the db
}}}

This patch changes get_FOO_list() to pre-cache the parent object so that the get_poll call wouldn't have to hit the db. In the example, p has already been loaded, and because c was created from it, we know that it is the answer to get_poll().

I haven't investigated how this would apply to the magic-removal branch.

"	enhancement	closed	contrib.admin		normal	fixed			Unreviewed	0	0	0	0	0	0
