Metadata-Version: 2.4
Name: bottle-renderer
Version: 0.1.1
Summary: Renderer plugin for bottle
Home-page: https://github.com/agreatjewel/bottle_plugins/tree/master/bottle_renderer
Author: Ajeet Grewal
Author-email: asgrewal@gmail.com
License: MIT
Platform: any
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires: bottle (>=0.9)
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: platform
Dynamic: requires
Dynamic: summary

bottle_renderer
===============

This plugin allows you to specify a renderer for per route. Here is an example

::

    from bottle import Bottle
    from bottle_renderer import RendererPlugin

    app = Bottle()
    renderer = RendererPlugin(template_context = {'FB_APP_ID': 1234}) # This will be available in templates

    # You can override the renderers by specifying your own.
    # renderer.add_renderer('json', your_json_renderer)

    app.install(renderer)
    app.uninstall('json') # no autojson

    # to use in a route, just specify the "renderer" attribute
    @app.get('/main', name='main', renderer='main.jinja2')
    def get_main():
        # do something
        return ret_value


In your templates (jinja2, mako, etc.)  you can access the following by default:

:R: return value of the function
:app:  The current app
:request: The current request
:response: The current response

The following renderers are available:

::

    @app.get(renderer='json', ..) # Renders return value as json
    @app.get(renderer='string', ..) # Renders return value as text/plain
    @app.get(renderer='<template_filename>.stpl', ..) # simple 
    @app.get(renderer='<template_filename>.mako', ..) 
    @app.get(renderer='<template_filename>.jinja2', ..) 
    @app.get(renderer='<template_filename>.cheetah', ..) 
    @app.get(renderer='<template_filename>.simpletal', ..)
