{ "info": { "author": "Lovely Systems GmbH", "author_email": "office@lovelysystems.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "===========================\nSession Data Using memcache\n===========================\n\nThis package provides a session data manager which stores it's data in\nmemcache. The package uses lovely.memcached to store it's data.\n\nIMPORTANT:\n\nThis test expects a memcache server running on local port 11211 which\nis the default port for memcached.\n\nThis test runs in level 2 because it needs external resources to work. If you\nwant to run this test you need to use --all as parameter to your test.\n\nStart a memcache instance with : memcached \n\n\nOnce memcached is running, we can start testing:\n\n >>> from zope import component\n >>> from lovely.memcached.interfaces import IMemcachedClient\n >>> from lovely.memcached.utility import MemcachedClient\n >>> util = MemcachedClient()\n >>> component.provideUtility(util, IMemcachedClient, name='session')\n >>> util.invalidateAll()\n\n\nImport the container we will use for caching tests.\n\n >>> from lovely.session.memcached import MemCachedSessionDataContainer\n\nTimeout behavior\n~~~~~~~~~~~~~~~~\n\nWe need to test the timeout capability of the container. We can do this by simulating the passage of time while minimizing the timeout period.\n\nCreate a new session data that we will cause to timeout.\n\n >>> timeoutSessionData = MemCachedSessionDataContainer()\n >>> timeoutSessionData.cacheName = u'session'\n >>> timeoutSessionData.__name__ = 'MemCacheSession'\n\n >>> timeoutSession = timeoutSessionData['mySessionId']\n >>> timeoutSession\n {}\n\nSo we expect it is empty at this point. Get a new session from it.\n\n >>> timeoutData = timeoutSession['myData1']\n >>> timeoutData\n {}\n\nOkay, so now add some data to that session.\n\n >>> timeoutData['info'] = 'stored in memcache'\n >>> timeoutData\n {'info': 'stored in memcache'}\n\nNow get that sessionData from the session. It should just give it to us and the sessionData should have data.\n\n >>> timeoutData = timeoutSession['myData1']\n >>> timeoutData\n {'info': 'stored in memcache'}\n\nNow simulate the effect of a timeout by forcing one.\n\n >>> timeoutSessionData.timeout=1\n >>> timeoutSessionData.lastAccessTime=0\n\nNow ask the sessionData for the session again. If the timeout worked, the session will be empty.\n\n >>> timeoutSession = timeoutSessionData['mySessionId']\n >>> timeoutSession\n {}\n\nAttempt to get the data from the session anyway and it will also be empty.\n\n >>> timeoutData = timeoutSession['myData1']\n >>> timeoutData\n {}\n\n\nNormal memcache access\n~~~~~~~~~~~~~~~~~~~~~~\n\nNow we create a memcache session and connect it to the memcached client.\n\n >>> sessionData = MemCachedSessionDataContainer()\n >>> sessionData.cacheName = u'session'\n\nWe need to provide a name for the session data manager because it is used to\nidentify the cache entry in memcache.\n\n >>> sessionData.__name__ = 'MemCacheSession'\n\n >>> session = sessionData['mySessionId']\n >>> session\n {}\n >>> type(session)\n \n\nWe can now get data from the session.\n\n >>> data = session['myData']\n >>> data\n {}\n >>> type(data)\n \n\n >>> data['info'] = 'stored in memcache'\n >>> data\n {'info': 'stored in memcache'}\n\n\nTransaction support\n~~~~~~~~~~~~~~~~~~~\n\nBecause the MemCacheSession is transaction aware we need to commit the\ntransaction to store data in the memcache.\n\n >>> import transaction\n\n >>> transaction.commit()\n\nIf we now read session data it is read back from the memcache.\n\n >>> session = sessionData['mySessionId']\n >>> session['myData']\n {'info': 'stored in memcache'}\n\n >>> sessionData.items()\n [('mySessionId', )]\n\n\nMemCacheSession is now also savepoint aware, let's check how that works:\n\nWe first set some data:\n\n >>> session = sessionData['mySessionId']\n >>> data = session['myData']\n >>> data['info'] = 'we want to keep this'\n\nSet a savepoint:\n\n >>> savepoint = transaction.savepoint()\n\nChange the data:\n\n >>> data['info'] = 'this should be dumped'\n\nRollback to the previous value:\n\n >>> savepoint.rollback()\n\nAnd here it is, the before value:\n\n >>> data['info']\n 'we want to keep this'\n\nNewly added data must also go away:\n\nWe add a new data:\n\n >>> data['newinfo'] = 'go away'\n\nAnd a new container:\n\n >>> newdata = session['myNewData']\n >>> newdata['foo'] = 'bar'\n\nRoll it back to the previous savepoint:\n\n >>> savepoint.rollback()\n\nThe data is gone:\n\n >>> data['newinfo']\n Traceback (most recent call last):\n ...\n KeyError: 'newinfo'\n\nThe container is empty, because it gets always created on retrieval:\n\n >>> session['myNewData']\n {}\n\nLet's see what happens on commit:\n\n >>> transaction.commit()\n\nIf we now read session data it is read back from the memcache.\n\n >>> session = sessionData['mySessionId']\n >>> session['myData']\n {'info': 'we want to keep this'}\n\nThe data is not present:\n\n >>> data['newinfo']\n Traceback (most recent call last):\n ...\n KeyError: 'newinfo'\n\nThe container is empty, because it gets always created on retrieval:\n\n >>> session['myNewData']\n {}\n\n\n=======\nCHANGES\n=======\n\n0.3.0 (12-11-2009)\n------------------\n\n- Use zope.container instead of zope.app.container\n\n- Removed unused dependencies\n\n\n0.2.2 (2009-08-14)\n------------------\n\n- Add 'lastAccessTime' class attribute (fix old instances)\n\n\n0.2.1 (2009-08-14)\n------------------\n\n- Correctly implemented timeout behavior of session data.\n\n- Remove duplicate extras_require (python2.4 compatibility)\n\n\n0.2.0 (2008-09-25)\n------------------\n\n- Made the DataManager savepoint aware.\n\n\n0.1.4 (2008-07-31)\n------------------\n\n- Fixed ZCML to avoid deprecation warnings, since the session API was moved to\n ``zope.session``. *Sigh*\n\n\n0.1.3 (2008-07-31)\n------------------\n\n- Fixed `setup.py` to be on par with the latest layout.\n\n- Fixed deprecation warnings, since the session API was moved to\n ``zope.session``.\n\n\n0.1.2 (2007-08-13)\n------------------\n\n- Move source to svn.zope.org.\n\n\n0.1.1 (2007-08-13)\n------------------\n\n- Fixed dependency on `lovely.memcached`.\n\n\n========\nDownload\n========", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/lovely.session", "keywords": "zope3 session memcache", "license": "ZPL 2.1", "maintainer": null, "maintainer_email": null, "name": "lovely.session", "package_url": "https://pypi.org/project/lovely.session/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/lovely.session/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/lovely.session" }, "release_url": "https://pypi.org/project/lovely.session/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "memcache-based session storage", "version": "0.3.0" }, "last_serial": 683105, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "f67d417f7f19a63afe80ec280164cdfb", "sha256": "eb92b6b2808b8c916861b4df40d5ab86058aba995081733ffb8c1b6e5692bd15" }, "downloads": -1, "filename": "lovely.session-0.1.2-py2.4.egg", "has_sig": false, "md5_digest": "f67d417f7f19a63afe80ec280164cdfb", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 12856, "upload_time": "2007-12-10T15:01:11", "url": "https://files.pythonhosted.org/packages/58/08/474ab056613d0a60bfe0072b329bbc96906207167877874abf695879310b/lovely.session-0.1.2-py2.4.egg" }, { "comment_text": "", "digests": { "md5": "bed6f42446d6cbd9831cfcefb51f5d72", "sha256": "5c651ed89d377ab7c43e0cd0e1ae9e59de0c5910abb0465b9b4f5a79cd9b8d57" }, "downloads": -1, "filename": "lovely.session-0.1.2.tar.gz", "has_sig": false, "md5_digest": "bed6f42446d6cbd9831cfcefb51f5d72", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6526, "upload_time": "2007-12-10T15:01:11", "url": "https://files.pythonhosted.org/packages/b2/ec/9efe782da53c62227e820d1feec06dea1f33c708686f903f3ada1670bb96/lovely.session-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "af58692d4ba595120b214cd8f15ed08e", "sha256": "de938413808c31a2781e4b7237e82c1a992a70e3ca205a37d1617020abd0f612" }, "downloads": -1, "filename": "lovely.session-0.1.3.tar.gz", "has_sig": false, "md5_digest": "af58692d4ba595120b214cd8f15ed08e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6835, "upload_time": "2008-07-31T14:17:21", "url": "https://files.pythonhosted.org/packages/dd/fa/682f261be407e592639d5623e5fb9e9ff895067bb2140a8d04994c65ca1a/lovely.session-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "14fb98c239db0e77c42925c0e8efbd97", "sha256": "4cf69ac67226cd43b3fdf5c79ceec8ecbe1a1fb4100c70601adf21a02f977b7a" }, "downloads": -1, "filename": "lovely.session-0.1.4.tar.gz", "has_sig": false, "md5_digest": "14fb98c239db0e77c42925c0e8efbd97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6856, "upload_time": "2008-07-31T14:36:35", "url": "https://files.pythonhosted.org/packages/7d/a8/51dd845f0fbe3273c126504c50a2a743aa0dd69a2e730e06f2feb8348a1d/lovely.session-0.1.4.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "b324b25adc4d73f334f0520b6aa0cc96", "sha256": "452d11007b347239cd60abd725dc61190c953aa2cbb630643cf8a49a65b1c870" }, "downloads": -1, "filename": "lovely.session-0.2.0.tar.gz", "has_sig": false, "md5_digest": "b324b25adc4d73f334f0520b6aa0cc96", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7996, "upload_time": "2008-09-25T23:15:07", "url": "https://files.pythonhosted.org/packages/54/5f/71856b87df993dde1f8cb41ff6a81578abb1a6110676312f65bc784c8d0f/lovely.session-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "de85d0087c406701b7024cafc41ee0d4", "sha256": "7fde817c4832e5559451cea43ba0f32a3592ac90e829091af9ed2762f45be3ff" }, "downloads": -1, "filename": "lovely.session-0.2.1.tar.gz", "has_sig": false, "md5_digest": "de85d0087c406701b7024cafc41ee0d4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9550, "upload_time": "2009-08-14T00:31:50", "url": "https://files.pythonhosted.org/packages/5d/03/dc8bbcce183b52bebed62674845a979dba64dded80f2a2c5b074b0dae34a/lovely.session-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "0ab97c92b0076d28cfc07a5d6be1f050", "sha256": "669a496cadf79defc35241acd82497937706b5b89aa8c7c50cbc428fbb64f4b7" }, "downloads": -1, "filename": "lovely.session-0.2.2.tar.gz", "has_sig": false, "md5_digest": "0ab97c92b0076d28cfc07a5d6be1f050", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9613, "upload_time": "2009-08-14T13:02:38", "url": "https://files.pythonhosted.org/packages/08/3d/a23130df81abb8330d7c6bad5704c2d0d5f45fa0ddf5d8859932c47bccb5/lovely.session-0.2.2.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "90a1cad7bb294e134f5244788d9c78da", "sha256": "5dfb12ca3508f52e86c19a07e8cd368dfa999014e58bd0a802beb339b779e7f5" }, "downloads": -1, "filename": "lovely.session-0.3.0.tar.gz", "has_sig": false, "md5_digest": "90a1cad7bb294e134f5244788d9c78da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9974, "upload_time": "2009-12-11T08:21:17", "url": "https://files.pythonhosted.org/packages/0d/25/1253f505ec9b31e04ac618603916875db0271c27c51c5135f471c2167f74/lovely.session-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "90a1cad7bb294e134f5244788d9c78da", "sha256": "5dfb12ca3508f52e86c19a07e8cd368dfa999014e58bd0a802beb339b779e7f5" }, "downloads": -1, "filename": "lovely.session-0.3.0.tar.gz", "has_sig": false, "md5_digest": "90a1cad7bb294e134f5244788d9c78da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9974, "upload_time": "2009-12-11T08:21:17", "url": "https://files.pythonhosted.org/packages/0d/25/1253f505ec9b31e04ac618603916875db0271c27c51c5135f471c2167f74/lovely.session-0.3.0.tar.gz" } ] }