Permalink
Browse files

Document flash and caching

  • Loading branch information...
1 parent 374eba4 commit 8af4d63c6b4eca0ade01c091bf914be6f64b7afb @amol- amol- committed Apr 3, 2012
Showing with 14 additions and 0 deletions.
  1. +1 −0 docs/main/Caching.rst
  2. +13 −0 docs/main/WebFlash.rst
View
@@ -156,6 +156,7 @@ Another speed boost can be achieved by disabling template automatic reloading.
[app:main]
auto_reload_templates = false
+.. _prerendered-templates-cache:
Prerendered Templates Caches
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
View
@@ -67,3 +67,16 @@ using plain css:
background:#EEEEFF url(../images/info.png) no-repeat scroll 10px center;
}
+
+Caching with Flash Messages
+=============================
+
+When using ``tg_cache`` variable in rendered templates (:ref:`prerendered-templates-cache`)
+the flash will get into the cached template causing unwanted messages to be displayed.
+
+To solve this issue the ``tg.flash_obj.render`` method provides the ``use_js`` option.
+By default this option is set at False inside the template, changing it to True
+will make the flash message to be rendered using javascript. This makes so that the same
+template is always rendered with a javascript to fetch the flash message and display it
+due to the fact that the template won't change anymore it will now be possible to
+correctly cache it.

0 comments on commit 8af4d63

Please sign in to comment.