{ "info": { "author": "Maurits van Rees", "author_email": "maurits@vanrees.org", "bugtrack_url": null, "classifiers": [ "Framework :: Plone", "Framework :: Plone :: 3.3", "Framework :: Plone :: 4.0", "Framework :: Plone :: 4.1", "Framework :: Plone :: 4.2", "Framework :: Plone :: 4.3", "Framework :: Plone :: 5.0", "Programming Language :: Python", "Programming Language :: Python :: 2.4", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "Introduction\n============\n\nThis is a small package for Zope2 that does something similar to a\npart of what the PasswordResetTool from Plone does. It stores a\nvalue, with a possible validation token, and guards it with a secret.\n\nThe PasswordResetTool uses a similar technique to store password reset\nrequests; it then sends an email with a link and a generated secret to\na given email address. When the recipient follows the link and fills\nin the secret (this is actually part of the link so this is done\nimplicitly) and his user name (the validation token) he is allowed to\nset a fresh password.\n\nThis package is meant to support this and similar use cases. The part\nthis package does is:\n\n- storing the value (done with annotations)\n\n- possibly confirming in case there is a validation token\n\n- getting the value\n\n- editing the value\n\n- removing the value\n\nNo emails are sent. If that is needed for a use case, that is the\nresponsibility of integrators.\n\n\nTarget audience\n===============\n\nTarget audience is integrators, as the package does not really do\nanything interesting for end users. You will have to build something\naround it. This could be as easy as a PloneFormGen form. Here are\nsome possible use cases.\n\n- You could use this to store an email address that needs to be\n confirmed before adding it to a mailing list.\n\n- Or you generate 1,000 secrets, print them, hand them out on a trade\n show, and give people 5 euro when they register on your website with\n this secret; perhaps you could cobble something like this together\n in combination with PloneFormGen.\n\n\nDependencies\n============\n\nTested with Plone 3.3.5, 4.0.9, 4.1, 4.2, 4.3.6, 5.0.\nMight work in Plone 2.5 already.\nProbably works in plain Zope2 as well.\n\n\nInstall\n=======\n\nAdd this to the eggs of your buildout. On Plone 3.2 or lower also\nload the zcml (done automatically in 3.3 or higher).\n\nSample usage\n============\n\nThere are some sample browser views in the sample directory of the\npackage. If you want to use them in a test instance, load their\nzcml; in a buildout config that would be something like this::\n\n [instance]\n ...\n zcml =\n ...\n collective.depositbox.sample\n\nRerun buildout, start the instance, and in the root of the site (or\nsomewhere else) visit ``@@deposit-simple`` or ``@@deposit-add``. If\nyou follow the instructions of the last one you will add, confirm,\nedit and delete an item.\n\n\nSample code\n===========\n\nThis should give you an idea of how you should use the code::\n\n >>> from collective.depositbox.store import Box\n >>> box = Box()\n >>> secret = box.put(object())\n >>> box.get(secret)\n \n >>> box.edit(secret, 42)\n >>> box.get(secret)\n 42\n >>> box.pop(secret)\n 42\n >>> box.pop(secret)\n >>> secret = box.put('my data', token='maurits@example.com')\n >>> box.get(secret, token='maurits@example.com') is None\n True\n >>> box.confirm(secret, token='maurits@example.com')\n True\n >>> box.get(secret, token='maurits@example.com')\n 'my data'\n >>> box.get(secret, token='bad@example.com') is None\n True\n >>> box.pop(secret) is None\n True\n >>> box.pop(secret, token='maurits@example.com')\n 'my data'\n\n\nStoring data persistently\n=========================\n\nIf you instantiate a ``Box()`` like above, but do not add the box to\nsome object in the database, then you will lose your data once your\nPlone Site restarts. The normal way to save the box is to use an\nadapter to store it in annotations on the context::\n\n from collective.depositbox.interfaces import IDepositBox\n box = IDepositBox(context)\n\nThat context can be the Plone Site root, a folder, a document or\nwhatever you want. You can have multiple boxes: different contexts\nwill have different boxes. A secret for one box is not valid for\nanother box.\n\n\nExpiring\n========\n\nNote that after a while (7 days by default) the secret expires and the\ndata is removed.\n\n\nIntegrators\n===========\n\nThe default adapter is registered for anything that is\nIAttributeAnnotatable, which is true for any content item in Plone.\nIt adds one deposit box on the context. This may be fine for your use\ncase, but maybe you want something else. So here are a few ideas.\n\n- Look in ``config.py`` for some settings you could easily override in a\n monkey patch.\n\n- Maybe replace the random ``id_generator`` using a monkey patch if\n you don't like the secrets that are generated. Secrets are\n currently 8 characters from the lowercase alphabet or digits. We\n avoid accidentally creating (swear) words by excluding vowels, and\n avoid further confusion by excluding 0 and 1. 8 characters sampled\n from these 28 characters give 125 billion possible results. That is\n enough for 1 random key every second for almost 4000 years. If you\n want some uuid thingie instead that is fine. I like that the secret\n is short so that you can safely include it as part of a url in an\n email without making the link too long, which can lead to problems\n in some email programs.\n\n- You could register your own adapter that inherits from\n ``BoxAdapter``. You can then override ``ANNO_KEY`` so you can store\n a box under a different name. With ``max_age`` you can determine\n the number of days before a secret expires. Similarly, with\n purge_days you can determine how often old items get purged. Maybe\n register this adapter specifically for IPloneSiteRoot.\n\n- You can add a value in the deposit box and get the secret back in a\n page template with a TAL definition like this::\n\n depositview nocall:context/@@deposit-box;\n secret python:depositview.put('foobar');\n\n For a slightly bigger example see\n ``collective/depositbox/sample/templates/simple.pt``.\n\nChangelog\n=========\n\n\n1.3 (2015-09-01)\n----------------\n\n- Added documentation about using the ``IDepositBox`` adapter.\n [maurits]\n\n\n1.2 (2014-08-04)\n----------------\n\n- Add locales, with Dutch translations.\n [maurits]\n\n- Add simple ``deposit-box-data`` view to see confirmed data. You may\n want to override this in your own code with some view that presents\n it in a nicer way because it knows what kind of values are stored.\n [maurits]\n\n- Add permission ``collective.depositbox: View Data``. Allow access\n to ``get_all_confirmed`` data when the user has this permission.\n We do not grant the permission explicitly, so by default only a\n Manager has it.\n [maurits]\n\n\n1.1 (2012-09-13)\n----------------\n\n- Moved to github: https://github.com/collective/collective.depositbox\n [maurits]\n\n\n1.0 (2011-08-13)\n----------------\n\n- Initial release.\n [maurits]", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/collective/collective.depositbox", "keywords": "anonymous secret", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "collective.depositbox", "package_url": "https://pypi.org/project/collective.depositbox/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/collective.depositbox/", "project_urls": { "Homepage": "https://github.com/collective/collective.depositbox" }, "release_url": "https://pypi.org/project/collective.depositbox/1.3/", "requires_dist": null, "requires_python": null, "summary": "Put stuff in a box, get it out again with the secret", "version": "1.3" }, "last_serial": 1703463, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "f1e0151dc260a1241c039a69fe678f61", "sha256": "d91f9b55597e3a2ac2521d0cb9dc4e9bf14eacdcaceb1a7b23c0d5688cc2f88a" }, "downloads": -1, "filename": "collective.depositbox-1.0.zip", "has_sig": false, "md5_digest": "f1e0151dc260a1241c039a69fe678f61", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37954, "upload_time": "2011-08-13T02:50:31", "url": "https://files.pythonhosted.org/packages/a6/b4/e71de5587dd8f1872a3b19f49c0a7244159e9557ca753631cd0d94fd5bb3/collective.depositbox-1.0.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "fc3ffeb8363fd40e8ece7da8f5c14792", "sha256": "0e72b7b908470a0430b345e2e5467d1e5b7512553ca16cc6314dcf9a270253d6" }, "downloads": -1, "filename": "collective.depositbox-1.1.zip", "has_sig": false, "md5_digest": "fc3ffeb8363fd40e8ece7da8f5c14792", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37906, "upload_time": "2012-09-13T13:23:49", "url": "https://files.pythonhosted.org/packages/38/a5/686c7095f4ca85b54a13fd4890f317c792475cd54b606ffc357a7be83d10/collective.depositbox-1.1.zip" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "c873178ab10ff63ed9653e578ad7e80f", "sha256": "1e0d3f0a857e21f3f6249d3d6023f457d4c75994e5acc6972f46891a81eb46da" }, "downloads": -1, "filename": "collective.depositbox-1.2.zip", "has_sig": false, "md5_digest": "c873178ab10ff63ed9653e578ad7e80f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44439, "upload_time": "2014-08-04T14:24:55", "url": "https://files.pythonhosted.org/packages/28/64/6b74de352bce5bee9d3aeda35a538a9664e136ade9baab7d8e7f0969efe4/collective.depositbox-1.2.zip" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "c0fb5f01a9975965c069129d3c37b6ad", "sha256": "e7515e5900960921cde64de561e19b90e209f4dac33094090139a7c02c3a9220" }, "downloads": -1, "filename": "collective.depositbox-1.3.tar.gz", "has_sig": false, "md5_digest": "c0fb5f01a9975965c069129d3c37b6ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24670, "upload_time": "2015-09-01T16:33:06", "url": "https://files.pythonhosted.org/packages/30/8b/7804f917eed38ac584b4907dbc2b8dd54f201aa889b4e3c00c78c15351c4/collective.depositbox-1.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c0fb5f01a9975965c069129d3c37b6ad", "sha256": "e7515e5900960921cde64de561e19b90e209f4dac33094090139a7c02c3a9220" }, "downloads": -1, "filename": "collective.depositbox-1.3.tar.gz", "has_sig": false, "md5_digest": "c0fb5f01a9975965c069129d3c37b6ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24670, "upload_time": "2015-09-01T16:33:06", "url": "https://files.pythonhosted.org/packages/30/8b/7804f917eed38ac584b4907dbc2b8dd54f201aa889b4e3c00c78c15351c4/collective.depositbox-1.3.tar.gz" } ] }