Package: player
playerplayer allows to address templates with two parameters,
category and name. Also it is possible to use set of directories
for each layer, in that caseplayersearches templates
in each directory. It allows to override templates without changing
code. For example form library can define layerfield:>> ls ./fields/
.. bool.pt
.. file.pt
...
.. textarea.ptIn your application you can override any of this template by defining
new layer forfieldcategory:>> ls ./myproject/fields/
.. bool.ptUsually top level directory is a category and file in directory is template.
For example ‘form:view.lt’:`form` - layer category
`view` - template name
`.lt`  - custom pyramid renderer factoryLayer can to be defined withadd_layerconfig directive:>>config=Configurator()..config.include('player')....config.add_layer('form',path='./path_to_form_dirctory/form/')formdirectory can contain any template:>>./form/..view.pt..actions.jinja2It is possible to use any of this templates as pyramid renderer path:>>config.add_view(..name='view.html',..renderer='form:view.lt')or :>>config.add_view(..name='actions.html',..renderer='form:actions.lt')It is possible to run python code before rendering template.
There areadd_tmpl_filterdirective andplayer.tmpl_filterdecorator:>>defform_actions(context,request):..return{'url':...}>>config.add_tmpl_filter('form:actions',form_action,name='custom')or:>>importplayer>>@player.tmpl_filter('form:actions',name='custom')..defform_actions(context,request):..return{'url':...}form_actionsfunction gets call just before rendering template.
Layer has to be defined withadd_layerdirectve before registering
template filter function.CustomizationAny number of layer categories can be registered and any number of
layers can be registered in each category. It doesnt require to override
all templates from category. For example it is possible to override just
view.pt template:>> config.add_layer('form', 'custom', path='path_to_form_directory_2/form')and content of this new directory:>> ./another_path/form/
..   view.jinja2Now viewview.htmlusesview.jinja2template. Butactions.htmlstil
uses original template.Another example, if you want customizeboolfield from ptah.form package
all you need is to create some folder, add it as ‘fields’ layer, and putbool.pttemplate to this folder, something like that:>> config.add_layer('fields', 'custom', 'mypackage:fields')and>> .mypackage/fields/
..    bool.ptRequest methodplayeralso provides request methodrender_tmpl. It acccepts
path:..  ${structure: request.render_tmpl('form:actions').ltextension is optional in this case.player…Licenseplayer is offered under the BSD license.CHANGES0.6.1 (01-22-2013)Added python 2.60.6 (12-10-2012)Allow to use standard renderers inrenderfunction0.5 (11-30-2012)Use jinja2 for templatesAddedlayout_datarequest propertyAllow to pass several messages toerrormessage0.4 (11-12-2012)Addedplayer.layoutrendererAdded-cargument toplayerconsole script,
it allows to customize templatesset_layout_dataaccepts keyword argumentsRemovedplayer.wrap_layout()Removed python2.6 support0.3 (11-07-2012)Addedset_layout_datarequest method, allow to set global layout optionsAdded status messagesAdded formatters0.2 (11-01-2012)Addedlayoutsubsystem0.1 (10-30-2012)Initial release