{ "info": { "author": "Rok Garbas", "author_email": "mailto:info@4teamwork.ch", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Introduction\n============\n\nThis package provides a layer for storing key / value paires. The storage\ncan be configured dinamically by providing a ``IConfig`` adapter of the\ncontext on which the dict storage is used.\n\n\nExamples\n========\n\nThe adapter defaults to using a non-persistent dict:\n\n::\n\n >>> from ftw.dictstorage.interfaces import IDictStorage\n\n >>> context = layer['example_context']\n >>> print context\n \n\n >>> storage = IDictStorage(context)\n >>> storage['key'] = 'value'\n >>> print storage['key']\n value\n\n >>> print storage.storage\n {'key': 'value'}\n\n >>> print IDictStorage(context).storage\n {}\n\n\nFor configuring a custom storage, implement your own ``IConfig`` which uses\ncustom ``IDictStorage``:\n\n::\n\n >>> from ftw.dictstorage.interfaces import IConfig\n >>> from ftw.dictstorage.base import DictStorage\n >>> from zope.component import provideAdapter, adapts\n >>> from zope.interface import Interface, alsoProvides, implements\n\n >>> context = layer['example_context']\n >>> class IMyContext(Interface):\n ... pass\n >>> alsoProvides(context, IMyContext)\n\n >>> class ContextStorageConfig(object):\n ... implements(IConfig)\n ... adapts(IMyContext)\n ...\n ... def __init__(self, context):\n ... self.context = context\n ...\n ... def get_storage(self):\n ... if not hasattr(self.context, '_dictstorage'):\n ... self.context._dictstorage = {}\n ... return self.context._dictstorage\n >>> provideAdapter(ContextStorageConfig)\n\n >>> class ContextDictStorage(DictStorage):\n ... implements(IDictStorage)\n ... adapts(IMyContext, IConfig)\n ...\n ... def __init__(self, context, config):\n ... self.context = context\n ... self.config = config\n ... self._storage = config.get_storage()\n ...\n ... @property\n ... def storage(self):\n ... return self._storage\n ...\n >>> provideAdapter(ContextDictStorage)\n\n >>> storage = IDictStorage(context)\n >>> storage['foo'] = 'bar'\n >>> print storage['foo']\n bar\n\n >>> print context._dictstorage\n {'foo': 'bar'}\n\n >>> print IDictStorage(context)['foo']\n bar\n\n\nIf you use sqlalchemy,\n\n\nLinks\n=====\n\n- Main github project repository: https://github.com/4teamwork/ftw.dictstorage\n- Issue tracker: https://github.com/4teamwork/ftw.dictstorage/issues\n- Package on pypi: http://pypi.python.org/pypi/ftw.dictstorage\n- Continuous integration: https://jenkins.4teamwork.ch/search/?q=ftw.dictstorage\n\n\nCopyright\n---------\n\nThis package is copyright by `4teamwork `_.\n\n``ftw.dictstorage`` is licensed under GNU General Public License, version 2.\n\nChangelog\n=========\n\n\n1.2 (2012-06-05)\n----------------\n\n- Declare zope dependencies.\n [jone]\n\n- Update README.\n [jone]\n\n\n1.1 (2012-03-28)\n----------------\n\n- Remove \"self\" from IDictStorage interface definitions.\n This makes it possible to validate a implementation with verifyClass.\n [jone]\n\n\n1.0 (2011-11-17)\n----------------\n\n- added test-buildout for plone 4.1\n [eschmutz]\n\n1.0a4 (2011-07-12)\n------------------\n\n- Fixed signature of some class methods\n [lgraf]\n\n\n1.0a3\n-----\n\n1.0a2\n-----", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/4teamwork/ftw.dictstorage/", "keywords": "ftw key value storage sqlalchemy dictstorage", "license": "GPL2", "maintainer": null, "maintainer_email": null, "name": "ftw.dictstorage", "package_url": "https://pypi.org/project/ftw.dictstorage/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/ftw.dictstorage/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/4teamwork/ftw.dictstorage/" }, "release_url": "https://pypi.org/project/ftw.dictstorage/1.2/", "requires_dist": null, "requires_python": null, "summary": "Provides a layer for storing key / value paires.", "version": "1.2" }, "last_serial": 5823615, "releases": { "1.2": [ { "comment_text": "", "digests": { "md5": "3ac981e8d1413b59f3a4eca083d5eb7c", "sha256": "0e1db1b909189444b322bff911af0109c60142faef9587028e3b072e0517a836" }, "downloads": -1, "filename": "ftw.dictstorage-1.2.tar.gz", "has_sig": false, "md5_digest": "3ac981e8d1413b59f3a4eca083d5eb7c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11551, "upload_time": "2012-06-05T13:13:12", "url": "https://files.pythonhosted.org/packages/54/3c/90ceb9721a6381393c58f9bddf2fe28c50ac5cca17556880159ad304eee3/ftw.dictstorage-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3ac981e8d1413b59f3a4eca083d5eb7c", "sha256": "0e1db1b909189444b322bff911af0109c60142faef9587028e3b072e0517a836" }, "downloads": -1, "filename": "ftw.dictstorage-1.2.tar.gz", "has_sig": false, "md5_digest": "3ac981e8d1413b59f3a4eca083d5eb7c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11551, "upload_time": "2012-06-05T13:13:12", "url": "https://files.pythonhosted.org/packages/54/3c/90ceb9721a6381393c58f9bddf2fe28c50ac5cca17556880159ad304eee3/ftw.dictstorage-1.2.tar.gz" } ] }