{ "info": { "author": "makoto kuwata", "author_email": "kwa@kuwata-lab.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Webext is a library to provide very fast 'escape_html()' function.\nIt is implemented as C extension and it runs much faster than pure Python code\nsuch as 'cgi.escape()'.\n\n\nInstallation\n------------\n\n::\n\n $ tar xzf Webext-0.0.1.tar.gz\n $ cd Webext-0.0.1\n $ sudo python setup.py install\n\n\nFunctions\n---------\n\nWebext provides following functions:\n\n* webext.escape_html()\n\n - escapes HTML special characters (< > & \").\n - converts unicode into str with 'utf8' encoding.\n - converts None into empty string (= '').\n\n* webext.escape()\n\n - alias to webext.escape_html()\n\n* webext.to_str()\n\n - converts argument into str (same as str())\n - converts unicode into str with 'utf8' encoding.\n - converts None into empty string (= '').\n\n* webext.get_encoding()\n\n - returns default encoding for escape_html() and to_str()\n - default value is 'utf8'\n\n* webext.set_encoding(arg)\n\n - sets default encoding for escape_html() and to_str()\n\n\nExample\n-------\n\n::\n\n ### import escape_html() and to_str()\n >>> from webext import escape_html, to_str\n\n ### escape_html() escapes html special characters\n >>> escape_html('< > & \"')\n '< > & "'\n\n ### to_str() and escape_html() convert unicode into str with 'utf8' encoding\n >>> to_str(u'\\u65e5\\u672c\\u8a9e')\n '\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e'\n >>> escape_html(u'\\u65e5\\u672c\\u8a9e')\n '\\xe6\\x97\\xa5\\xe6\\x9c\\xac\\xe8\\xaa\\x9e'\n\n ### to_str() and escape_html() convert None into empty string\n ### (this is more desirable than str() for web application)\n >>> to_str(None)\n ''\n >>> escape_html(None)\n ''\n\n\nUsing with Tenjin\n-----------------\n\n`Tenjin `_ is a very fast template engine\nimplemented in pure Python. You can make Tenjin much faster by using Webext.\n\n::\n\n import tenjin\n from tenjin.helpers import *\n from webext import to_str, escape # use webext's to_str() and escape() instead of tenjin's\n engine = tenjin.Engine()\n context = { 'items': ['', 'B&B', '\"CCC\"'] }\n print engine.render('example.pyhtml', context)\n\n\nTenjin's benchmark now supports Webext. The following is an example of\nbenchmark result on Mac OS X 10.6, Intel Core Duo 2GHz, Tenjin 0.9.0.\nThis shows that Webext boosts Tenjin especially html escaping.\n\n::\n\n ## without html escaping\n $ python bench.py -n 10000 tenjin tenjin-\n webext\n import tenjin ... done. (0.001740 sec)\n import webext ... done. (0.000466 sec)\n *** loading context data (file=bench_context.py)...\n *** start benchmark\n *** ntimes=10000\n utime stime total real\n tenjin 3.8100 0.0400 3.8500 3.8584\n tenjin-webext 2.5000 0.0300 2.5300 2.5367\n \n ## with html escaping\n $ python bench.py -e -n 10000 tenjin tenj\n in-webext\n import tenjin ... done. (0.001580 sec)\n import webext ... done. (0.000459 sec)\n *** loading context data (file=bench_context.py)...\n *** start benchmark\n *** ntimes=10000\n utime stime total real\n tenjin 7.2100 0.0500 7.2600 7.2935\n tenjin-webext 2.9800 0.0400 3.0200 3.0476", "description_content_type": null, "docs_url": null, "download_url": "http://pypi.python.org/packages/source/W/Webext/Webext-0.0.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/Webext/", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "Webext", "package_url": "https://pypi.org/project/Webext/", "platform": "any", "project_url": "https://pypi.org/project/Webext/", "project_urls": { "Download": "http://pypi.python.org/packages/source/W/Webext/Webext-0.0.1.tar.gz", "Homepage": "http://pypi.python.org/Webext/" }, "release_url": "https://pypi.org/project/Webext/0.0.1/", "requires_dist": null, "requires_python": null, "summary": "C extension module for escape_html()", "version": "0.0.1" }, "last_serial": 786006, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "51ff32046ffb5cad025cd4d5d54eae3e", "sha256": "6e9cdba615f2b63d789035b4b3db1209ba4a271a576a858c5c1a6a9e0808c1e8" }, "downloads": -1, "filename": "Webext-0.0.1.tar.gz", "has_sig": false, "md5_digest": "51ff32046ffb5cad025cd4d5d54eae3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15113, "upload_time": "2010-07-19T16:29:58", "url": "https://files.pythonhosted.org/packages/f2/84/705e30745034f4f76b95fd0c5c6142d381fed945c7d97171fb9b79b9beb4/Webext-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "51ff32046ffb5cad025cd4d5d54eae3e", "sha256": "6e9cdba615f2b63d789035b4b3db1209ba4a271a576a858c5c1a6a9e0808c1e8" }, "downloads": -1, "filename": "Webext-0.0.1.tar.gz", "has_sig": false, "md5_digest": "51ff32046ffb5cad025cd4d5d54eae3e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15113, "upload_time": "2010-07-19T16:29:58", "url": "https://files.pythonhosted.org/packages/f2/84/705e30745034f4f76b95fd0c5c6142d381fed945c7d97171fb9b79b9beb4/Webext-0.0.1.tar.gz" } ] }