Oh right, actually add that hook we just documented, "template_context_prerender" :)
authorChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 15 May 2013 16:11:24 +0000 (11:11 -0500)
committerChristopher Allan Webber <cwebber@dustycloud.org>
Wed, 15 May 2013 16:11:24 +0000 (11:11 -0500)
This commit sponsored by William Goudie.  Thanks Bill! :)

mediagoblin/tools/template.py

index aab571f0e41d0ef42b571ca3a59fc1673b523480..3d651a6e0602cad26f4a9843bedd67d0933d10c3 100644 (file)
@@ -113,6 +113,13 @@ def render_template(request, template_path, context):
             (request.controller_name, template_path),
             context)
 
+    # More evil: allow plugins to possibly do something to the context
+    # in every request ever with access to the request and other
+    # variables.  Note: this is slower than using
+    # template_global_context
+    context = hook_transform(
+        'template_context_prerender', context)
+
     rendered = template.render(context)
 
     if common.TESTS_ENABLED: