{ "info": { "author": "Ross Patterson", "author_email": "me@rpatterson.net", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ";-*-Doctest-*-\n\n=====================\nz3c.persistentfactory\n=====================\n\nThe ZCA and the ZODB are a good combination where components require\npersistent state. ZCA factories or handlers typically retrieve any\npersistent state required from the persistent objects being adapted.\nIf the persistent state required is not specific to the objects being\nadapted, a common solution is to register a persistent utility which\nis then looked up in the factory or handler. The persistent utility\napproach requires, however, that the one appropriate utility is looked\nup which requires support in the ZCA registrations either in the\ninterface provided or the utility name.\n\nIn some cases, however, it is more consistent with the object oriented\nsemantics of Python and the ZCA to think of the factory or handler as\nan instance method of a persistent object. With this approach the\nnon-context specific persistent state can be accessed on self.\n\nInstance Method Event Handler\n=============================\n\nOne example where this may be useful is where some non-context\npersistent state is tightly coupled to some event handlers in such a\nway where instance methods are better semantics.\n\nThe Baz class uses the decorator in the python code. Note that the\nfactory decorator must come before the declaration decorators so that\nit will be run last and will reflect the declarations.\n\n >>> from z3c.persistentfactory import testing\n >>> baz = testing.Baz()\n\nRegister the persistent factory wrapped instance method as a handler.\n\n >>> from zope import component\n >>> component.provideHandler(factory=baz.factory)\n \nThe method adapts IFoo, so create an object providing IFoo to be used\nas the event.\n\n >>> component.adaptedBy(baz.factory)\n (,)\n\n >>> from zope import interface\n >>> foo = testing.Foo()\n >>> interface.alsoProvides(foo, testing.IFoo)\n\nWhen the event is notified, the method is called with the event as an\nargument.\n\n >>> import zope.event\n >>> zope.event.notify(foo)\n Called >\n args: (,)\n kwargs: {}\n\nInstance Method Adapter Factory\n===============================\n\nAnother example is where an adapter factory needs to look up\npersistent state specific to the objects being adapted but where that\nstate can't be stored on the adapted objects them selves. The\ncomponent storing the shared persistent state can register one of it's\ninstance methods as the adapter factory which will look up the\nnecessary persistent state on self.\n\nRegister the persistent factory wrapped instance method as an adapter\nfactory.\n\n >>> component.provideAdapter(factory=baz.factory)\n \nThe method implements IBar.\n\n >>> tuple(interface.implementedBy(baz.factory))\n (,)\n\nWhen the adapter is looked up, the metod is called with the object to\nbe adapted as an argument.\n\n >>> result = component.getAdapter(foo, testing.IBar)\n Called >\n args: (,)\n kwargs: {}\n >>> result\n (>,\n (,), {})\n\nChangelog\n=========\n\n0.3 - 2008-04-10\n----------------\n\n* Declarer's declarations don't track with changes to the\n class method's declarations.\n\n* Isolate declarations on the declarer's class from declarations on\n instances.\n\n0.2 - 2008-04-09\n----------------\n\n* Improve README.txt with clearer examples\n\n0.1 - 2008-04-08\n----------------\n\n* Initial release", "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/z3c.persistentfactory", "keywords": "", "license": "ZPL", "maintainer": null, "maintainer_email": null, "name": "z3c.persistentfactory", "package_url": "https://pypi.org/project/z3c.persistentfactory/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/z3c.persistentfactory/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://pypi.python.org/pypi/z3c.persistentfactory" }, "release_url": "https://pypi.org/project/z3c.persistentfactory/0.3/", "requires_dist": null, "requires_python": null, "summary": "Wrap instance methods in persistent factory wrappers for using instance methods as ZCA factories.", "version": "0.3" }, "last_serial": 802063, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "74490a0453eb346ccd337fbcd77e828a", "sha256": "c364f39c475509186d47e5b7bbf66299f2b24b995b8a67c33b499ec009ade785" }, "downloads": -1, "filename": "z3c.persistentfactory-0.1.tar.gz", "has_sig": false, "md5_digest": "74490a0453eb346ccd337fbcd77e828a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5265, "upload_time": "2008-04-09T06:40:34", "url": "https://files.pythonhosted.org/packages/69/f8/2a14dd7bba182b060f763a9fb1f468bc3962b70bb6a5a377133b78affdff/z3c.persistentfactory-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "fd1e8d1ffa5f021e42e7b25579bc5ec5", "sha256": "c2e5cec5da0efd72595f962e6623dc8be4f27bc93bf1bed8cbd60ab57c7b8b49" }, "downloads": -1, "filename": "z3c.persistentfactory-0.2.tar.gz", "has_sig": false, "md5_digest": "fd1e8d1ffa5f021e42e7b25579bc5ec5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7305, "upload_time": "2008-04-09T21:03:05", "url": "https://files.pythonhosted.org/packages/bc/9a/ea600b6d439dfdd3a7071198ba1663b36f093b74b7e72ff310be79b00c2f/z3c.persistentfactory-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "e25bb82c332acedde04b2b40f07562e5", "sha256": "cd3448542887b82c0ce94258403df34aeaf9325e4c963fcda0dc1df083128573" }, "downloads": -1, "filename": "z3c.persistentfactory-0.3.tar.gz", "has_sig": false, "md5_digest": "e25bb82c332acedde04b2b40f07562e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7472, "upload_time": "2008-04-10T20:08:08", "url": "https://files.pythonhosted.org/packages/c6/bc/66183618a4cec252675760f47fb39077999eab1beb2befc5098f5141bbb9/z3c.persistentfactory-0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e25bb82c332acedde04b2b40f07562e5", "sha256": "cd3448542887b82c0ce94258403df34aeaf9325e4c963fcda0dc1df083128573" }, "downloads": -1, "filename": "z3c.persistentfactory-0.3.tar.gz", "has_sig": false, "md5_digest": "e25bb82c332acedde04b2b40f07562e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7472, "upload_time": "2008-04-10T20:08:08", "url": "https://files.pythonhosted.org/packages/c6/bc/66183618a4cec252675760f47fb39077999eab1beb2befc5098f5141bbb9/z3c.persistentfactory-0.3.tar.gz" } ] }