Login

Tag "mako"

Snippet List

Test Integration for mako templates

This is a small addition to the mako template processing plugin for django that allows you to use the unit test framework with mako templates. To install, put the code into a file on your python path, and add the python path to your settings.py file. For example, if you install the code at /usr/lib/python2.5/site-packages/mako_django/test_integration.py you would add the following line to settings.py: TEST_RUNNER="mako_django.test_integration.run_mako_tests" This code will still call all of the normal test code, it just adds the mako template handler onto the list of things that are monitored.

  • mako
  • testing
  • test
  • mako-django
Read More

Mako support as decorator

This snippet allows you to use @mako("templatename.mako") to define a mako template to use. Your python method just has to return a dictionary that will be passed to mako's context, after the addition of the "request" variable to the dictionary. If you return a non-False non dictionary object, it will return that instead of trying to render the template. The **request** variable is automatically added to the template's context. It also searches the current application's mako_templates/ subdirectory first before searching under the current directories mako_templates/, and does not use other application's mako_templates/ subdirectories at all. On Mako exceptions, it will display the Mako error page when debugging is enabled (hoping for extensible exception handling in the future to keep consistency) I got the idea from a [CherryPy tool](http://tools.cherrypy.org/wiki/Mako).

  • mako
Read More
Author: rmt
  • 2
  • 2

intergrate mako and genshi with django

You can download these files from [here](http://huangyilib.googlecode.com/svn/trunk/mashi_django) Django template, mako, genshi, they are the best three templates in python, aren't they? How to use these files ? [Using Mako in Django](http://fuzzythinker.blogspot.com/2007/04/using-mako-in-django.html) -- by John Leung

  • template
  • mako
  • genshi
Read More

3 snippets posted so far.