Update 2013-05-27: I’m no longer using this project, if somebody wants to take over maintanance, email me.
megrok.genshi
megrok.genshi makes it possible to use Genshi templates in Grok. The project is no longer maintained due to lack of usage, but can still work as an example of how to do template integration in Grok.
For more information on Grok and Genshi see:
Requirements
Genshi. Tested with v 0.5.1.
Grok v0.14 or later. Tested with 0.14.
Installation
To use Genshi under Grok all you need is to install megrok.genshi as an egg and include it’s zcml. The best place to do this is to make megrok.genshi a dependency of your application by adding it to your install_requires list in setup.cfg. If you used grokprojet to create your application setup.cfg is located in the project root. It should look something like this:
install_requires=['setuptools',
'grok',
'megrok.genshi',
# Add extra requirements here
],
Then include megrok.genshi in your configure.zcml. If you used grokproject to create your application it’s at src/<projectname>/configure.zcml. Add the include line after the include line for grok, but before the grokking of the current package. It should look something like this:
<include package="grok" /> <include package="megrok.genshi" /> <grok:grok package="." />
Then run bin/buildout again. You should now see buildout saying something like:
Getting distribution for 'megrok.genshi'. Got megrok.genshi 1.0.
That’s all. You can now start using Genshi in your Grok application!
Usage
megrok.genshi supports the Grok standard of placing templates in a templates directory, for example app_templates, so you can use Genshi by simply placing the Genshi templates in the templates directory, just as you would with ZPT templates. Although Genshi itself doesn’t have a standard for the file extensions for Genshi templates, Grok needs to have an association between an extension and a type so it knows which type of template each template is. megrok.genshi defines the extension .g for Genshi HTML templates and .gt for Genshi Text templates. Genshi can also include templates, and although you can use any extension for this we recommend you use .gi for any include templates, to avoid any clashes with other templating languages.
You can also use Genshi templates inline. The syntax for this is:
from megrok.genshi.components import GenshiMarkupTemplate, GenshiTextTemplate
index = GenshiMarkupTemplate('<html>the html code</html>')
index = GenshiMarkupTemplate('Text templates')
Or if you use files:
from megrok.genshi.components import GenshiMarkupTemplate, GenshiTextTemplate index = GenshiMarkupTemplate(filename='thefilename.html') index = GenshiMarkupTemplate(filename='thefilename.txt')
CHANGES
Version 1.0
Support for Grok 0.14. (Paul Wilson)
Version 0.9
Initial release
Metadata
Release files for megrok.genshi 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| megrok.genshi-1.0.zip | 15.6 kB | Without provenance | Details for megrok.genshi-1.0.zip |
Release files / megrok.genshi-1.0.zip
| Download URL | megrok.genshi-1.0.zip |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
63207ee42d3f9e5a779a5f975df4aa06147209239d802843e2906ef3752149dd
|
|
BLAKE2b-256 checksum How to use checksums |
c9d8af098693b2e16945c8aced6914a058e202ac60011e305bcce82933b0352c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for megrok.genshi 1.0
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.