{ "info": { "author": "Livio Ribeiro", "author_email": "livioribeiro@outlook.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: CherryPy", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "===================================\r\nlribeiro.cherrypy.templating.genshi\r\n===================================\r\n \r\nGenshi renderer for ``lribeiro.cherrypy.templating``\r\n \r\nIt has three optional config entries:\r\n \r\n- templating.genshi.template_directories: can be a path to the templates directory, list of paths, or anything ``genshi.template.TemplateLoader`` accepts. If none is given, ``{root module directory}/templates`` is used as the template diretory.\r\n \r\n- templating.genshi.loader_options: ``dict`` containing additional arguments passed to the TemplateLoader constructor\r\n \r\n- templating.genshi.render_options: ``dict`` containing arguments used when rendering the template, for example, {'method': 'html', 'doctype': 'html-transitional'}\r\n \r\nYou can also pass arguments to the render via ``@template`` decorator args and kwargs.\r\n \r\n.. sourcecode:: python\r\n \r\n class Controller:\r\n @cherrypy.expose\r\n @template('template_name.html', method='xhtml', doctype='xhtml11')\r\n def handler(self):\r\n pass\r\n \r\nWhen setting the template name, remember that **Genshi interprets a leading slash as an absolute path**! So the following would probably raise a TemplateNotFound:\r\n \r\n.. sourcecode:: python\r\n \r\n class WrongController:\r\n @cherrypy.expose\r\n # pay attention to the leading slash\r\n # Genshi will look for a 'wrong_template_name.html' file on the root of the filesystem\r\n @template('/wrong_template_name.html')\r\n def wrong_handler(self):\r\n pass\r\n \r\nDeveloped under Python3.4 and tested against Python2.7, Python3.4 and pypy.\r\n \r\nUsage:\r\n------\r\n \r\n.. sourcecode:: python\r\n\r\n import cherrypy\r\n\r\n from lribeiro.cherrypy.templating import template\r\n from lribeiro.cherrypy.templating.genshi import renderer\r\n\r\n\r\n class Root(object):\r\n @cherrypy.expose\r\n @template('index.html')\r\n def index(self):\r\n return {'context': 'variables'}\r\n\r\n @cherrypy.expose\r\n @template('/var/templates/page.html') # absolute path\r\n def page(self):\r\n return {'context': 'variables'}\r\n\r\n\r\n config = {\r\n '/': {\r\n 'templating.renderer': renderer,\r\n 'templating.genshi.template_directories': [\r\n 'templates', # relative to the module where the root class was declared\r\n '/var/templates' # absolute path\r\n ],\r\n 'templating.genshi.loader_options': {'default_encoding': 'utf-8'}, # this is optional\r\n 'templating.genshi.render_options': {'method': 'html', 'doctype': 'html5'} # this is also optional\r\n }\r\n }\r\n \r\n if __name__ == '__main__':\r\n cherrypy.quickstart(Root(), '/', config)", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://bitbucket.org/livioribeiro/cherrypy-templating-genshi", "keywords": "templating,cherrypy,genshi", "license": "BSD License", "maintainer": "", "maintainer_email": "", "name": "lribeiro.cherrypy.templating.genshi", "package_url": "https://pypi.org/project/lribeiro.cherrypy.templating.genshi/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/lribeiro.cherrypy.templating.genshi/", "project_urls": { "Homepage": "http://bitbucket.org/livioribeiro/cherrypy-templating-genshi" }, "release_url": "https://pypi.org/project/lribeiro.cherrypy.templating.genshi/1.0/", "requires_dist": null, "requires_python": null, "summary": "Genshi renderer for lribeiro.cherrypy.templating", "version": "1.0" }, "last_serial": 1760251, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "0336240861792dfe4effc7f1aaf5ef7a", "sha256": "2a0e57b604f9763d42199fc901af9bbd1a56d87bccb4b44bd1e68fe7e078f4dc" }, "downloads": -1, "filename": "lribeiro.cherrypy.templating.genshi-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0336240861792dfe4effc7f1aaf5ef7a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7014, "upload_time": "2014-09-11T16:03:55", "url": "https://files.pythonhosted.org/packages/ce/75/b6e198892c16cdf81c2efc6d08860ccca592d70ad43fe445cb167b9957a6/lribeiro.cherrypy.templating.genshi-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "912f06e65a0f4515c1bab2b6207f38fe", "sha256": "4586d0172216a1a78512cb3f6dca7b04ceda3e1f6d456be97e8d21fe4faf29b8" }, "downloads": -1, "filename": "lribeiro.cherrypy.templating.genshi-1.0.tar.gz", "has_sig": false, "md5_digest": "912f06e65a0f4515c1bab2b6207f38fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3787, "upload_time": "2014-09-11T16:03:58", "url": "https://files.pythonhosted.org/packages/15/ea/2e815e1dfd7b126c1195712bd5795e3362033995b831ab6bd393480c8da5/lribeiro.cherrypy.templating.genshi-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0336240861792dfe4effc7f1aaf5ef7a", "sha256": "2a0e57b604f9763d42199fc901af9bbd1a56d87bccb4b44bd1e68fe7e078f4dc" }, "downloads": -1, "filename": "lribeiro.cherrypy.templating.genshi-1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0336240861792dfe4effc7f1aaf5ef7a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 7014, "upload_time": "2014-09-11T16:03:55", "url": "https://files.pythonhosted.org/packages/ce/75/b6e198892c16cdf81c2efc6d08860ccca592d70ad43fe445cb167b9957a6/lribeiro.cherrypy.templating.genshi-1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "912f06e65a0f4515c1bab2b6207f38fe", "sha256": "4586d0172216a1a78512cb3f6dca7b04ceda3e1f6d456be97e8d21fe4faf29b8" }, "downloads": -1, "filename": "lribeiro.cherrypy.templating.genshi-1.0.tar.gz", "has_sig": false, "md5_digest": "912f06e65a0f4515c1bab2b6207f38fe", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3787, "upload_time": "2014-09-11T16:03:58", "url": "https://files.pythonhosted.org/packages/15/ea/2e815e1dfd7b126c1195712bd5795e3362033995b831ab6bd393480c8da5/lribeiro.cherrypy.templating.genshi-1.0.tar.gz" } ] }