Sup, I've been working on template caching (ticket #6262) with a mister Alex Gaynor. The patch is getting pretty stable and I think it's close to merge-able, so if anyone wants to take a look at what we've got and provide feedback: go!
Interesting background reading for people who haven't been part of this conversation: http://groups.google.com/group/django-developers/browse_thread/thread/b289b871285b86f5/b97ba9e2e9b9ad86 Ticket: http://code.djangoproject.com/ticket/6262 Latest patch: http://code.djangoproject.com/attachment/ticket/6262/cache_templates.5.diff The more code reviewers the better, but if you don't have time to read through the nitty gritty here's a high level overview of the changes: 1. The workhorse django.template.loader.get_template() function will now return compiled Template objects directly if a template loader returns one (where a Template object is defined as something with a render() method). 2. A RenderContext has been added to Context instances. This is necessary so we can give template.Node instances a thread-safe place to store state between calls to Node.render(). 3. The built-in template tags were updated to use the render context (specifically, CycleNode, BlockNode, and ExtendsNode). 4. A caching loader has been added to the set of default loaders. To use it, you instantiate the loader, passing a list of other loaders that it should wrap. The first time you ask the loader for a template it'll go through the wrapped loaders and find it, then cache it in memory. Subsequent requests for the same template are served from cache. Hazzah! The patch is pretty complete, it includes tests and docs, so please take a look! I stuck the updated docs up on my website temporarily, so if you want to take a look at them in a slightly more readable format you can check out these URLs: http://immike.net/django-docs/ref/templates/api.html#loader-types http://immike.net/django-docs/howto/custom-template-tags.html#template-tag-thread-safety http://immike.net/django-docs/ref/templates/api.html#using-an-alternative-template-language Thanks, Mike -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=.