{ "info": { "author": "Benjamin Le Forestier", "author_email": "benjamin@leforestier.org", "bugtrack_url": null, "classifiers": [ "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.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Internationalization", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "An implementation of lazy strings. Can be used in combination with *gettext* for the translation of web apps.\n\nIt's less beautiful than *speaklater* (an other implementation\nof lazy strings), but I wanted lazy strings that work even if a\nsingle thread interleaves the processing of many http requests (this happens with async frameworks).\n\n*postpone* doesn't rely on a global state. And it doesn't use the ``thread.local()`` trick that *speaklater* uses either.\n\nExample of use:\n\n.. code:: python\n\n >>> from postpone import evalr, LazyString as _\n\n >>> translations = {\n \"Order {item}.\": \"Commander {item}.\",\n \"Take a nap\": \"Faire une sieste\",\n \"Stare at the wall for %s minutes.\": \"Fixer le mur pendant %s minutes.\" ,\n \"a new pillow\": \"un nouvel oreiller\" \n }\n\n >>> tasklist = [\n _(\"Order {item}.\").format(item = _(\"a new pillow\")),\n _(\"Take a nap\") + '!', \n _(\"Stare at the wall for %s minutes.\") % 30\n ]\n\n >>> evalr(tasklist, translations.get)\n ['Commander un nouvel oreiller.', 'Faire une sieste!', 'Fixer le mur pendant 30 minutes.']\n\n`evalr` walks python dictionaries, lists, tuples or sets and apply\na function to all the strings wrapped inside a `LazyString` object.\n\nTo apply a function to the strings inside a single expression, you can use the `eval` method:\n\n.. code:: python\n\n >>> s = _(\"Take a nap\") + '!'\n\n >>> s.eval(str.upper)\n 'TAKE A NAP!'\n\n >>> s.eval(translations.get)\n 'Faire une sieste!'\n\nOr, again, the `evalr` function\n\n.. code:: python\n\n >>> evalr(_(\"a new pillow\").capitalize(), translations.get)\n 'Un nouvel oreiller'\n\n\nFor most projects containing more than a few strings or languages, you'll probably want to \nuse the gettext_ module to supply you with a translation function.\n\n.. code:: python\n\n import gettext\n translation = gettext.translation(\"myproject\", \"./locale\", [\"fr\"])\n translated_tasklist = evalr(tasklist, translation.ugettext)\n\nGitHub repo: https://github.com/leforestier/postpone\n\n.. _gettext: https://docs.python.org/3/library/gettext.html\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/leforestier/postpone", "keywords": "lazy", "license": "", "maintainer": "", "maintainer_email": "", "name": "postpone", "package_url": "https://pypi.org/project/postpone/", "platform": "", "project_url": "https://pypi.org/project/postpone/", "project_urls": { "Homepage": "https://github.com/leforestier/postpone" }, "release_url": "https://pypi.org/project/postpone/0.3.0/", "requires_dist": null, "requires_python": "", "summary": "A lazy string implementation that doesn't rely on a global or thread local state.", "version": "0.3.0" }, "last_serial": 3025075, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "c2f4a1861b6087a01123110607de1db9", "sha256": "f8e64c6f75b24ac9f9f3552c96a8a76e9a99d14fb78df08fd7b5b00562e18338" }, "downloads": -1, "filename": "postpone-0.1.0.tar.gz", "has_sig": false, "md5_digest": "c2f4a1861b6087a01123110607de1db9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2720, "upload_time": "2016-01-07T13:05:36", "url": "https://files.pythonhosted.org/packages/59/51/291bbb4433cf6155e635b73decc28a45769a91b427af6b16d7d688075e5a/postpone-0.1.0.tar.gz" }, { "comment_text": "", "digests": { "md5": "17ab6d616cd3173e9d722ffd82edf06e", "sha256": "9470b61c630f70d291c88fd0e487f1ec5e925152479dab25dcdc52e529aabcd3" }, "downloads": -1, "filename": "postpone-0.1.0.zip", "has_sig": false, "md5_digest": "17ab6d616cd3173e9d722ffd82edf06e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4567, "upload_time": "2016-01-07T13:05:48", "url": "https://files.pythonhosted.org/packages/49/54/bde0bf4d1351356bf491a968056e33f52129decb5e6ead2a638be8408ca8/postpone-0.1.0.zip" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "af6024aebe4443fe22431cd4213a2360", "sha256": "e0611c2b373071603706f40747171c6017039be000714c671e3b8ba58f2c9f95" }, "downloads": -1, "filename": "postpone-0.1.1.tar.gz", "has_sig": false, "md5_digest": "af6024aebe4443fe22431cd4213a2360", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2725, "upload_time": "2016-02-05T15:56:37", "url": "https://files.pythonhosted.org/packages/aa/23/bbe4f314fde012ecb89b96b7affbdd88f0bf02a4e614a261295e957b3ae5/postpone-0.1.1.tar.gz" }, { "comment_text": "", "digests": { "md5": "d1dd89a790ddd1e6a7d6480a6129f217", "sha256": "f94dc1072496a904a2a3bfc6642696a6c7cd5b6b734609c8c5de537c6054aa99" }, "downloads": -1, "filename": "postpone-0.1.1.zip", "has_sig": false, "md5_digest": "d1dd89a790ddd1e6a7d6480a6129f217", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4596, "upload_time": "2016-02-05T15:56:58", "url": "https://files.pythonhosted.org/packages/6e/47/38d68a89158d5ece39dd28cd8e248e0f128f1f01a27487e0735dfe10793f/postpone-0.1.1.zip" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "9feb1638f82154c960c94101c4a839c8", "sha256": "3256347c4b672cc778c69b7bf6e2a2756252cc34828569b0a8e74d1f61ad7247" }, "downloads": -1, "filename": "postpone-0.2.0.tar.gz", "has_sig": false, "md5_digest": "9feb1638f82154c960c94101c4a839c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2897, "upload_time": "2017-01-15T12:37:39", "url": "https://files.pythonhosted.org/packages/e8/0b/16a13e79b3ab87e4d4f5bdc224599a5fc08aabaed5342618b1641d985348/postpone-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "77a521955b4b9865e37a0670e83aa750", "sha256": "f5e56320422ae8bd665c3b82eca017db194775b231ca6548db90cf8f0c0072df" }, "downloads": -1, "filename": "postpone-0.3.0.tar.gz", "has_sig": false, "md5_digest": "77a521955b4b9865e37a0670e83aa750", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2974, "upload_time": "2017-07-15T14:39:45", "url": "https://files.pythonhosted.org/packages/6b/b5/737b272c54d3e84c86d5bfc3694b27deb1b983a75e6ee856592b06066616/postpone-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "77a521955b4b9865e37a0670e83aa750", "sha256": "f5e56320422ae8bd665c3b82eca017db194775b231ca6548db90cf8f0c0072df" }, "downloads": -1, "filename": "postpone-0.3.0.tar.gz", "has_sig": false, "md5_digest": "77a521955b4b9865e37a0670e83aa750", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2974, "upload_time": "2017-07-15T14:39:45", "url": "https://files.pythonhosted.org/packages/6b/b5/737b272c54d3e84c86d5bfc3694b27deb1b983a75e6ee856592b06066616/postpone-0.3.0.tar.gz" } ] }