Edgewall Software

Changes between Version 15 and Version 16 of GenshiRecipes/PylonsWithGenshi


Ignore:
Timestamp:
Jun 4, 2010, 12:38:55 AM (14 years ago)
Author:
Thijs Triemstra <lists@…>
Comment:

add note about WebHelpers 1.0 deleted rails package

Legend:

Unmodified
Added
Removed
Modified
  • GenshiRecipes/PylonsWithGenshi

    v15 v16  
    33In Pylons 0.9.6rc1, you need to replace `template_engine='mako'` with `template_engine='genshi'` in `config/environment.py`.
    44
    5 Apparently as of Pylons 0.9.5, if you have genshi installed you may invoke genshi templates just by using `render_response("genshi","<templatename>")`. The instructions below are helpful for making genshi the "default" templates.
     5Apparently as of Pylons 0.9.5, if you have Genshi installed you may invoke Genshi templates just by using `render_response("genshi","<templatename>")`. The instructions below are helpful for making genshi the "default" templates.
    66
    77To use Genshi with [http://pylonshq.com/ Pylons] 0.9.4 and below, you need to take some additional steps, which is what's going to be explained here. See also the [http://docs.pythonweb.org/display/pylonscookbook/Genshi+templates Pylons Cookbook variant]
     
    3737
    3838Finally, the Pylons template plug-ins currently expect paths to act as module imports, so you will also need to create an empty `__init__.py` file inside appname/templates.
     39
    3940== !WebHelpers and Genshi ==
    4041To use [http://pylonshq.com/WebHelpers/ WebHelpers] within a Genshi template, the helper return values need to be wrapped in a Markup object, as it would otherwise be escaped.  Think carefully before following this suggestion, however, as this effectively works around the white-listing effect of the Markup object, automatically running any HTML that users may submit to your site.  It is safer (albiet much more annoying) to manually wrap specific WebHelpers in your pages.
     
    8384wrap_helpers(locals())
    8485}}}
     86
     87----
     88
     89'''Note''': as of !WebHelpers 1.0 the `webhelpers.rails` package [http://webhelpers.groovie.org/whats_new.html#deleted-packages has been removed] and it seems the `wrap_helpers` workaround above isn't required anymore(?)
     90
     91----
     92
    8593Now edit '''`<appname>/config/middleware.py`''' and just add:
    8694{{{