This release is a pre-release and may not be stable for production use.
That is made up of str, unicode, dict, tuple, list and Element.
usage
merge structured values to xhtml template.
>>> t = Template()
>>> t.fromstring("<div/>")
>>> str(t)
'<div/>'
>>> t.merge('hello')
>>> str(t)
'<div>hello</div>'
>>> t = Template()
>>> t.fromstring("<div><span class='y'/></div>")
>>> t.merge({'y':['1', '2']})
>>> str(t)
'<div><span class="y">1</span><span class="y">2</span></div>'
>>> t = Template()
>>> t.fromstring("<div><span class='y'/></div>")
>>> t.merge({'y':[({'@id':'m1'}, '1'),
... ({'@id':'m2'}, '2')]})
>>> str(t)
'<div><span class="y" id="m1">1</span><span class="y" id="m2">2</span></div>'
>>> t.fromstring("<div><div class='box'><span class='x'/><span
class='y'/></div></div>")
>>> t.merge({'box':[{'x':'1', 'y':'2'},
... {'x':'3', 'y':'4'}]})
>>> str(t)
'<div><div class="box"><span class="x">1</span><span
class="y">2</span></div><div class="box"><span class="x">3</span><span
class="y">4</span></div></div>'
>>> t.fromstring("<div/>")
>>> t.merge(ET.Element('span'))
>>> str(t)
'<div><span/></div>'
To use flexable as template engine for wsgi application, you can use
flexable.plugin:FlexablePlugin.
And that is python.template_engine entry point.
Example on TurboGears
controllers.py::
@expose(template="flexable:flexable_example.templates.example")
def example(self):
return dict(message="This is flexable message.",
contents=""" This is main contents from controller.
flexable is merge values to given html template with class attribute.
""")
flexable_example/templates/example.html::
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Flexable Template</h1>
<span class="message"></span>
<p class="contents"></p>
<span class="widget"/>
</body>
</html>
you get:
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<h1>Flexable Template</h1>
<span class="message">This is flexable message.</span>
<p class="contents"> This is main contents from controller.
flexable is merge values to given html template with class attribute.
</p>
</body>
</html>
Metadata
Release files for flexable 0.3dev
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 |
|---|---|---|---|---|
| flexable-0.3dev.tar.gz | 6.2 kB | Without provenance | Details for flexable-0.3dev.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| flexable-0.3dev-py2.5.egg | Legacy Egg format | - | - | Details for flexable-0.3dev-py2.5.egg |
Total release size: 19.1 kB
Release files / flexable-0.3dev.tar.gz
| Download URL | flexable-0.3dev.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f203fc8ab86c8568bf417c6e87f38e350c435365a595f377a46f2629b67c5c1c
|
|
BLAKE2b-256 checksum How to use checksums |
a056427ee394c48cf675ba43714ce1514e1596f219fc50be9d7b4ca5d9b735a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / flexable-0.3dev-py2.5.egg
| Download URL | flexable-0.3dev-py2.5.egg |
|---|---|
| Size | 12.9 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
54d110483ef497d61e2091832f7f03986012714372da21c4102825c9c556cf60
|
|
BLAKE2b-256 checksum How to use checksums |
8fc2ee3b9e3f16e95137271be6e5f1183cb022c2014501b015ec08fbded3a526
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for flexable 0.3dev
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.