Permalink
Browse files

killed another todo.

--HG--
branch : 2.1
  • Loading branch information...
percious
percious committed Oct 9, 2009
1 parent bf66ca3 commit cdf7f6be64222078f61b629bc320ce2b6b0b6d55
Showing with 24 additions and 2 deletions.
  1. +24 −0 docs/main/Config/Rendering.rst
  2. +0 −2 docs/misc.rst
@@ -62,6 +62,30 @@ value. For the four standard renderers it's enough to just add the
name to ``base_config.renderers`` but for custom renderers you want to
set the renderer up, and set it in this dictionary directly.
+
+Making a module available to all Genshi templates
+---------------------------------------------------
+Sometimes you want to expose an entire module to all of the templates
+in your templates directory. Perhaps you have a form library you
+like to use, or a png-txt renderer that you want to wrap with <pre>.
+This is possible in TG.
+
+First, we must modify our app_cfg.py so that you can share your
+link across all templates::
+
+ base_config.variable_provider = helpers.add_global_tmpl_vars
+
+Next, you want to modify the lib/helpers.py module of your application
+to include the newly added ``add_global_tmpl_vars`` method::
+
+ import mymodule
+
+ def add_global_tmpl_vars():
+ return dict(mymodule=mymodule)
+
+That's pretty much it, you should have access to mymodule in every
+template now.
+
Overriding AppConfig Rendering Methods
---------------------------------------
View
@@ -69,8 +69,6 @@ so I would wait until I re-write RoutedController with _dispatch before document
.. todo:: Difficulty: Medium. Include these docs: http://groups.google.com/group/turbogears/browse_frm/thread/3afbc13d88af57d3?hl=en TG2, repoze.who and multiple auth sources
-.. todo:: Difficulty: Medium. Include these docs: http://groups.google.com/group/turbogears/browse_frm/thread/31c4268417c5033c?hl=en Making a module available to all Genshi templates
-
.. todo:: Difficulty: Medium. Include these docs: http://groups.google.com/group/turbogears/browse_frm/thread/1c4158ad3035082c?hl=en Secure Static Files TG2
.. todo:: Difficulty: Medium. Include these docs: http://groups.google.com/group/turbogears/browse_frm/thread/55d6bb9704b3127a?hl=en Accessing configuration

0 comments on commit cdf7f6b

Please sign in to comment.