Skip to main content

Introduction

This package renders macros from a given page template using pure python.

Sometime you may want to use page templates like code libraries where for each functionality you have one macro. Calling macros is no problem using ZPT use-macro but how do you call macros from pure python code and also pass parameters? Because there do not seems to be an obvious solution for this problem (especially the parameters part) this package was created.

Render macro with name macroname from a given page template:

>>> from anthill.tal.macrorenderer import MacroRenderer
>>> template = ViewPageTemplateFile('template.pt')
>>> renderer = MacroRenderer(template, 'macroname')
>>> print renderer(data={'option1' : 42})

Sometimes you get an exception about not enough context being provided to the renderer (or for prior versions a TypeError).

A fix is easy: Simply add a context=self.context to the MacroRenderer call:

>>> renderer = MacroRenderer(template, 'macroname', context=self.context)

Changelog

0.2.1 (2009-08-24)

0.2 (2009-08-24)

  • Fix for missing context (TypeError exceptions) [spamsch]

0.1 (2009-08-08)

  • Initial release

Metadata

Release files for anthill.tal.macrorenderer 0.2.1

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

Source distribution (sdist)

Source distribution for anthill.tal.macrorenderer 0.2.1
File Size Uploaded Provenance
anthill.tal.macrorenderer-0.2.1.tar.gz 3.8 kB Without provenance Details

Release files / anthill.tal.macrorenderer-0.2.1.tar.gz

Download URL anthill.tal.macrorenderer-0.2.1.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
585f416a4c12241956be1fb13744d5b880b938eb2ff673561111624ca626c68c
BLAKE2b-256 checksum
How to use checksums
685a4118a98b7a70e87b290a9b2fd9117ad775dce16c90ad790ccf1bcc0d37db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for anthill.tal.macrorenderer 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

1 release file No provenance

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