{ "info": { "author": "Nikolay Kim", "author_email": "fafhrd91@gmail.com", "bugtrack_url": null, "classifiers": [ "Framework :: Pyramid", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: WSGI" ], "description": "pyramid_layer\n=============\n\n.. image :: https://secure.travis-ci.org/fafhrd91/pyramid_layer.png \n :target: https://secure.travis-ci.org/fafhrd91/pyramid_layer\n\npyramid_layer allows to address templates with two parameters, \ncategory and name. Also it is possible to use set of directories\nfor each layer, in that case `pyramid_layer` searches templates\nin each directory. It allows to override templates without changing\ncode. For example form library can define layer `field`::\n\n >> ls ./fields/\n .. bool.pt\n .. file.pt\n ...\n .. textarea.pt\n\nIn your application you can override any of this template by defining \nnew layer for `field` category::\n\n >> ls ./myproject/fields/\n .. bool.pt\n\nUsually top level directory is a category and file in directory is template.\nFor example 'form:view.lt'::\n\n `form` - layer category\n `view` - template name\n `.lt` - custom pyramid renderer factory\n\nLayer can to be defined with `add_layer` config directive:\n\n.. code-block:: python\n\n >> config = Configurator()\n .. config.include('pyramid_layer')\n ..\n .. config.add_layer('form', path='./path_to_form_dirctory/form/')\n\n`form` directory can contain any template:\n\n.. code-block:: python\n\n >> ./form/\n .. view.pt\n .. actions.jinja2\n\nIt is possible to use any of this templates as pyramid renderer path:\n\n.. code-block:: python\n\n >> config.add_view(\n .. name='view.html', \n .. renderer='form:view.lt')\n\nor :\n\n.. code-block:: python\n\n >> config.add_view(\n .. name='actions.html', \n .. renderer='form:actions.lt')\n\n\nIt is possible to run python code before rendering template. \nThere are `add_tmpl_filter` directive and `pyramid_layer.tmpl_filter` \ndecorator:\n\n.. code-block:: python\n\n >> def form_actions(context, request):\n .. return {'url': ...}\n\n >> config.add_tmpl_filter('form:actions', form_action, name='custom')\n \nor:\n\n.. code-block:: python\n\n >> import pyramid_layer\n\n >> @pyramid_layer.tmpl_filter('form:actions', name='custom')\n .. def form_actions(context, request):\n .. return {'url': ...}\n\n`form_actions` function gets call just before rendering template.\nLayer has to be defined with `add_layer` directve before registering \ntemplate filter function.\n\n\nCustomization\n-------------\n\nAny number of layer categories can be registered and any number of\nlayers can be registered in each category. It doesnt require to override \nall templates from category. For example it is possible to override just \nview.pt template::\n\n >> config.add_layer('form', 'custom', path='path_to_form_directory_2/form')\n\nand content of this new directory::\n\n >> ./another_path/form/\n .. view.jinja2\n\nNow view `view.html` uses `view.jinja2` template. But `actions.html` stil\nuses original template.\n\nAnother example, if you want customize `bool` field from ptah.form package\nall you need is to create some folder, add it as 'fields' layer, and put\n`bool.pt` template to this folder, something like that::\n\n >> config.add_layer('fields', 'custom', 'mypackage:fields')\n\nand ::\n\n >> .mypackage/fields/\n .. bool.pt\n\n\nRequest method\n--------------\n\n`pyramid_layer` also provides request method `render_tmpl`. It acccepts\npath::\n\n .. ${structure: request.render_tmpl('form:actions')\n\n`.lt` extension is optional in this case.\n\n\nplayer\n-------\n\n...\n\n\nLicense\n-------\n\npyramid_layer is offered under the BSD license.\n\nCHANGES\n=======\n\n0.2 (11-01-2012)\n----------------\n\n- Added `layout` subsystem\n\n\n0.1 (10-30-2012)\n----------------\n\n- Initial release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/fafhrd91/pyramid_layer/", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "pyramid_layer", "package_url": "https://pypi.org/project/pyramid_layer/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyramid_layer/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/fafhrd91/pyramid_layer/" }, "release_url": "https://pypi.org/project/pyramid_layer/0.2/", "requires_dist": null, "requires_python": null, "summary": "Pyramid view layers", "version": "0.2" }, "last_serial": 797620, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e6becc798a501ce7ebcc4c64b22b6819", "sha256": "03d19db013d1172eec5b22004b9a5d69bcb89f37d1d9abb0b67f9b8927a57773" }, "downloads": -1, "filename": "pyramid_layer-0.1.tar.gz", "has_sig": false, "md5_digest": "e6becc798a501ce7ebcc4c64b22b6819", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10551, "upload_time": "2012-10-30T17:24:08", "url": "https://files.pythonhosted.org/packages/0f/cd/b9fe179d4b75ee14112ad3acd029b17663dfb508d15a611ef1c156e632d7/pyramid_layer-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "1abd6e0b316365633b964761b63a92ba", "sha256": "adf24c5178f076e1f4a97ddd09679b2f7f7c4962456688861d72b9b05a5dcd35" }, "downloads": -1, "filename": "pyramid_layer-0.2.tar.gz", "has_sig": false, "md5_digest": "1abd6e0b316365633b964761b63a92ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14770, "upload_time": "2012-11-01T20:05:59", "url": "https://files.pythonhosted.org/packages/5b/4a/25d94c11706f251658e9e22791ba14ee1f49ffe2a10eaef520a5e835b8f0/pyramid_layer-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "1abd6e0b316365633b964761b63a92ba", "sha256": "adf24c5178f076e1f4a97ddd09679b2f7f7c4962456688861d72b9b05a5dcd35" }, "downloads": -1, "filename": "pyramid_layer-0.2.tar.gz", "has_sig": false, "md5_digest": "1abd6e0b316365633b964761b63a92ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14770, "upload_time": "2012-11-01T20:05:59", "url": "https://files.pythonhosted.org/packages/5b/4a/25d94c11706f251658e9e22791ba14ee1f49ffe2a10eaef520a5e835b8f0/pyramid_layer-0.2.tar.gz" } ] }