Skip to main content

This is a very simple recipe which generates a textfile from a template.

The template can be everything, and may contain python-style string formatters. The values will be replaced with the options you set inside the buildout.cfg section.

Parameters

template-directory – the directory to fetch templates from

template – the template file

default: $(name)s.in

location – the output file

${buildout:template-directory} is set to ${buildout:directory}/templates if not set in the buildout section.

If location is not set, no file is created. You can always access the generated content using the content key, though.

Example

An example buildout.cfg:

[buildout]
parts=test.txt
template-directory=${buildout:directory}/templates

[test.txt]
recipe=inquant.recipe.textfile
template-directory=${buildout:template-directory}
template=test.txt.in
location=${buildout:directory}/test.txt

avalue=foo
anothervalue=bar

Note that due to the default settings (see above), the template-directory and template settings are redundant.

An example text template:

This is just a test

template=%(template)s
location=%(location)s

This is just text %(avalue)s and %(anothervalue)s got
replaced. See?

The recipe will read the template and replace the strings yielding something like:

This is just a test

template=/Users/seletz/develop/plone/buildout/templates/test.txt.in
location=/Users/seletz/develop/plone/buildout/test.txt

This is just text foo and bar got
replaced. See?

EOF

vim: set ft=rst ts=2 sw=2 tw=75 expandtab:

Release files for inquant.recipe.textfile 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for inquant.recipe.textfile 0.2.3
File Size Uploaded
inquant.recipe.textfile-0.2.3.tar.gz 13.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for inquant.recipe.textfile 0.2.3
File Interpreter ABI Platform
inquant.recipe.textfile-0.2.3-py2.4.egg Legacy Egg format - - Details

Total release size: 19.9 kB

Release files / inquant.recipe.textfile-0.2.3.tar.gz

Download URL inquant.recipe.textfile-0.2.3.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9acff7cafa21d4924cb110f948a6a0d3ed27ffd0073f14205a72bff4492f12d8
BLAKE2b-256 checksum
How to use checksums
40729048139ffb7253c474378cfa3c6098721bf1e3ed026079212a4affd252b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / inquant.recipe.textfile-0.2.3-py2.4.egg

Download URL inquant.recipe.textfile-0.2.3-py2.4.egg
Size 6.2 kB
Tags Egg
SHA-256 checksum
How to use checksums
9dd574815cd97e64ee9098ddbebde559a095f5e830e7d81f6585cd9b0e04b597
BLAKE2b-256 checksum
How to use checksums
ae0099adf69a5c8af3ab874b4257ff3e5501f7f2fd706cb4bdc26d8def8cb00f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page