~brad-marshall/charms/trusty/apache2-wsgi/fix-haproxy-relations

« back to all changes in this revision

Viewing changes to hooks/lib/charmhelpers/contrib/templating/pyformat.py

  • Committer: Robin Winslow
  • Date: 2014-05-27 14:00:44 UTC
  • Revision ID: robin.winslow@canonical.com-20140527140044-8rpmb3wx4djzwa83
Add all files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'''
 
2
Templating using standard Python str.format() method.
 
3
'''
 
4
 
 
5
from charmhelpers.core import hookenv
 
6
 
 
7
 
 
8
def render(template, extra={}, **kwargs):
 
9
    """Return the template rendered using Python's str.format()."""
 
10
    context = hookenv.execution_environment()
 
11
    context.update(extra)
 
12
    context.update(kwargs)
 
13
    return template.format(**context)