{ "info": { "author": "Alessandro Molina", "author_email": "amol@turbogears.org", "bugtrack_url": null, "classifiers": [], "description": "About tgext.utils\n=================\n\n.. image:: https://travis-ci.org/TurboGears/tgext.utils.png?branch=master\n :target: https://travis-ci.org/TurboGears/tgext.utils\n\n.. image:: https://coveralls.io/repos/TurboGears/tgext.utils/badge.png?branch=master\n :target: https://coveralls.io/r/TurboGears/tgext.utils?branch=master\n\n.. image:: https://img.shields.io/pypi/v/tgext.utils.svg\n :target: https://pypi.python.org/pypi/tgext.utils\n\ntgext.utils is a collection of utilities for the TurboGears2 web framework.\n\nInstalling\n----------\n\ntgext.utils can be installed from pypi::\n\n pip install tgext.utils\n\nshould just work for most of the users.\n\nCSRF Protection\n===============\n\n``tgext.utils.csrf`` provides two decorators ``@csrf_token`` and ``@csrf_protect`` which\ngenerate a CSRF token for inclusion in a form and check that the token is valid.\n\nThe user must apply ``@csrf_token`` decorator to the action that exposes the form,\nand put an ```` into the form with a ``request.csrf_token`` as\nthe value and ``_csrf_token`` as name:\n\n.. code-block:: python\n\n @csrf_token\n @expose()\n def form(self):\n return '''\n
''' % request.csrf_token\n\nThe action that receives the form must have ``@csrf_protect`` decorator,\nno particular action or check is required on this action:\n\n.. code-block:: python\n\n @csrf_protect\n @expose()\n def post_form(self, **kwargs):\n return 'OK!'\n\nMetaTags\n========\n\n``tgext.utils.meta.metatags`` provides a convenient way to generate common meta tags\nfor a web page.\n\nIn ``lib/helpers.py`` add:\n\n.. code-block:: python\n\n from tgext.utils.meta import metatags\n\nThen in your pages:\n\n.. code-block:: html+genshi\n\n ${h.metatags(title=\"pagetitle\", description=\"Page Description\", image=\"http://url/myimage.png\")}\n\nSlug\n====\n\n``tgext.utils.slug`` provides a way to generate slug for your page\n\nto generate a slug use:\n\n.. code-block:: python\n\n from tgext.utils.slug import slugify\n myslug = slugify(model_id, string_to_be_inserted_in_the_url)\n\nto get the id from a slug use:\n\n.. code-block:: python\n\n from tgext.utils.slug import slug2entityid\n slug2entityid(myslug)\n\nStorage\n=======\n\n``tgext.utils.storage`` is a tool for storing files into /public dir in separated folders.\n\n.. code-block:: python\n\n from tgext.utils.storage import store\n\n filename = store(ufile) # ufile is an instance of cgi.FieldStorage\n\nfile is stored inside /public/storage/${uuid1} folder thus also accessible using internal tg file serving.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/amol-/tgext.utils", "keywords": "turbogears2.extension", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "tgext.utils", "package_url": "https://pypi.org/project/tgext.utils/", "platform": "", "project_url": "https://pypi.org/project/tgext.utils/", "project_urls": { "Homepage": "https://github.com/amol-/tgext.utils" }, "release_url": "https://pypi.org/project/tgext.utils/0.0.3/", "requires_dist": null, "requires_python": "", "summary": "Collection of utilities for TurboGears2", "version": "0.0.3" }, "last_serial": 3390372, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "8e9a6ce748f3d0ba73d3b6d8602b571e", "sha256": "0a6a3d9cdec7638d3559948692d7e7fd64baa1e2e153fa649e266231a78773b0" }, "downloads": -1, "filename": "tgext.utils-0.0.1.tar.gz", "has_sig": false, "md5_digest": "8e9a6ce748f3d0ba73d3b6d8602b571e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4265, "upload_time": "2016-04-03T22:58:12", "url": "https://files.pythonhosted.org/packages/f2/1a/8f31a1eef33bafff244648b9d0c6e3e4364a16a32c24bc75bc9edde8aa8e/tgext.utils-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "7c66ab9b37d81d2e35b9ddb65e4768b8", "sha256": "879efea6aef2da28333b863b93539013671ee08cfc55ef43cf5ffd15fd0ec006" }, "downloads": -1, "filename": "tgext.utils-0.0.2.tar.gz", "has_sig": false, "md5_digest": "7c66ab9b37d81d2e35b9ddb65e4768b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4862, "upload_time": "2016-09-07T22:05:42", "url": "https://files.pythonhosted.org/packages/05/0e/0ff7404efbc5a7d554a818b9c9dcddd35caa1ef57f7db9bcb2964079a5a5/tgext.utils-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "175db787bc4eadbf73268391b9b55b68", "sha256": "6dcf8f1be5947dcdc55cc8795cb99606a898346815ddd8fedcb78a794210b8c7" }, "downloads": -1, "filename": "tgext.utils-0.0.3.tar.gz", "has_sig": false, "md5_digest": "175db787bc4eadbf73268391b9b55b68", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5499, "upload_time": "2017-12-05T11:58:59", "url": "https://files.pythonhosted.org/packages/e2/bc/c78a72b343a36b55b8eb18120038fbfb76e9533f6ff0aa6a00fc37b53ed6/tgext.utils-0.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "175db787bc4eadbf73268391b9b55b68", "sha256": "6dcf8f1be5947dcdc55cc8795cb99606a898346815ddd8fedcb78a794210b8c7" }, "downloads": -1, "filename": "tgext.utils-0.0.3.tar.gz", "has_sig": false, "md5_digest": "175db787bc4eadbf73268391b9b55b68", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5499, "upload_time": "2017-12-05T11:58:59", "url": "https://files.pythonhosted.org/packages/e2/bc/c78a72b343a36b55b8eb18120038fbfb76e9533f6ff0aa6a00fc37b53ed6/tgext.utils-0.0.3.tar.gz" } ] }