{ "info": { "author": "schlerp", "author_email": "schlerpderpson@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Text Processing :: Markup :: HTML" ], "description": "\njinja2loader\n============\n\nThis package is to be used with simple cherrypy applications needing a quick\nand easy way to load templates from the file system.\n\nImporting and Setup\n-------------------\nIn order to use this module correctly you must import it and then set the\n`template_directory`. The `template_directory` is initially set to be\n`os.path.join(os.getcwd(), 'templates')`.\n\nIf your templates are stored in './templates/' then you can just import this\nmodule. ::\n \n import jinja2loader\n\nHowever, if your templates are in another directory structure you will\nneed to import the module and then set the template `template_directory`. A\nhelper function has been create to allow this, you can use it via calling\n`jinja2loader.set_template_directory('template_directory')`. ::\n \n import jinja2loader\n jinja2loader.set_template_directory('../resources/templates')\n\n\nload_template\n-------------\nThis Function wraps an application method which returns the\ncontext for a template, this decorator takes a single arguement, which is\nthe `template_name` to pass to `Environment.get_template(template_name)`\nWhen using this decorator all you need to do from your application\nfunction is to return the context you want to pass into the template. In\naddition you need to specify the `template_name` as the argument to the\ndecorator like `@load_template('template_name.html')`\nSee example below which loads a template 'test.html' using\n`Environment.get_template(template_name)`. ::\n\n class Application(object):\n @cherrypy.expose\n @load_template('test.html')\n def index(self):\n context = {'name': 'derp',\n 'name_list': ['bleep',\n 'blerp',\n 'herp']}\n return context\n\nThe above example will result in the template 'test.html' being rendered\nwith the context from the function `Application.index()`\nIf nothing is passed in as the context like in the below example, the\ndecorator method will automatically replace this with an empty `Dict`\nbefore the call the render. ::\n\n @load_template('test.html')\n def index(self):\n return\n\nThe above example will return the 'test.html' template, this is useful for\nloading and returning static pages which do not require context.\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/schlerp/jinja2loader", "keywords": "jinja2 decorator cherrypy", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "Jinja2Loader", "package_url": "https://pypi.org/project/Jinja2Loader/", "platform": "", "project_url": "https://pypi.org/project/Jinja2Loader/", "project_urls": { "Homepage": "http://github.com/schlerp/jinja2loader" }, "release_url": "https://pypi.org/project/Jinja2Loader/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "This module prodives a decorator for using jinja2 templates with cherry py in an easy way!", "version": "0.1.0" }, "last_serial": 2719484, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "cda7776e4d56cb4500082d2788426fe8", "sha256": "2623a9c1a7537ceb9d432ee420516fe3927f1304f289dda3fa1201e89b936fa9" }, "downloads": -1, "filename": "Jinja2Loader-0.1.0.tar.gz", "has_sig": false, "md5_digest": "cda7776e4d56cb4500082d2788426fe8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2848, "upload_time": "2017-03-21T05:57:18", "url": "https://files.pythonhosted.org/packages/f6/9b/4948feb0b603b0c93ab45eee83ccc31a3b2366be5f9a555a3db8f528806a/Jinja2Loader-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cda7776e4d56cb4500082d2788426fe8", "sha256": "2623a9c1a7537ceb9d432ee420516fe3927f1304f289dda3fa1201e89b936fa9" }, "downloads": -1, "filename": "Jinja2Loader-0.1.0.tar.gz", "has_sig": false, "md5_digest": "cda7776e4d56cb4500082d2788426fe8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2848, "upload_time": "2017-03-21T05:57:18", "url": "https://files.pythonhosted.org/packages/f6/9b/4948feb0b603b0c93ab45eee83ccc31a3b2366be5f9a555a3db8f528806a/Jinja2Loader-0.1.0.tar.gz" } ] }