{ "info": { "author": "JC Brand, Johannes Raggam, Robert Niederreiter", "author_email": "UNKNOWN", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Plone", "Framework :: Plone :: 4.3", "Framework :: Plone :: 5.0", "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "collective.instancebehavior\n===========================\n\nReferences\n----------\n\n- ``http://opkode.net/media/blog/plone-and-dexterity-enable-behaviors-per-content-type-instance``\n- ``https://gist.github.com/thet/3990769``\n\n\nProblem and Motivation\n----------------------\n\nBehaviors, provided by the ``plone.behavior`` package, provide a very useful\nway of extending the functionality of a Dexterity content type. Unfortunately,\nthe fact that a content type's behaviors are stored in its factory contents\ninformation (FTI) inside the portal_types tool, means that they are class\n(or type) specific, and not instance specific. This means that behaviors can\nonly be enabled globally, in other words only for all the instances of a\nspecific type.\n\nTo enable per instance behaviors, we need a way to store those behaviors\non the instance. We use annotations for this purpose.\n\nAdditionally We provide our own ``IBehaviorAssignable`` adapter that overrides\nthe default one to not only look for an object's FTI registered annotations,\nbut also look for the behaviors stored in the current instance's annotations.\n\nAlso helper functions are implemented which can be used to dynamically assing\nbehaviors and interfaces on dexterity content objects.\n\n\nInstallation\n------------\n\nDepend your plone product on ``collective.instancebehavior``.\n\n\nEnable behaviors and interfaces\n-------------------------------\n\nNote: the targeted object must implement ``collective.instancebehavior.IInstanceBehaviorAssignableContent``.\n\n::\n\n >>> from plone.app.event.dx.interfaces import IDXEvent\n >>> enable_behaviors(obj, ['plone.app.event.dx.behaviors.IEventBasic',],\n ... [IDXEvent,])\n\n\nDisable behaviors and interfaces\n--------------------------------\n\n::\n\n >>> from plone.app.event.dx.interfaces import IDXEvent\n >>> disable_behaviors(obj, ['plone.app.event.dx.behaviors.IEventBasic',],\n ... [IDXEvent,])\n\n\nTODO\n====\n\n::\n\n 12:13 < rnix> datakurre: https://github.com/bluedynamics/bda.plone.productshop/blob/master/bda/plone/productshop/browser/forms.py\n 12:13 < rnix> datakurre: woring instance behavior enabled add form\n 12:21 < rnix> datakurre: may be generalized to collective.instancebehavior -> just need a generic way on telling DX to use the correct form. -> idea would be to have a\n behavior which can be bound to folderish objects and this defined default behaviors applied dynamically\n 12:21 < rnix> to it's direct children\n 12:22 < rnix> but i do not really like to register this add view for every type.. would be more appropriate if we found a way on\n 12:22 < rnix> deciding by applied container interface\n 12:22 < rnix> something like that...\n 12:26 < datakurre> rnix: What the differences for original add form? 1) show fields for default instance behaviors 2) enable default instance behaviors on save?\n 12:28 < datakurre> rnix: 2) Could probably be done by instancebehavior-adapter (add form would call it, when instancebehavior-behavior is enabled)\n 12:28 < datakurre> rnix: 1) migth be possible with plone.z3cform's FormExtender\n 12:30 < rnix> datakurre: i was thinking of an IChildDefaultInstanceBehaviors behavior, which reads the available IInstanceBehavior deriving definitions. and sets them to\n all added children by default\n 12:30 < rnix> the add view can then be bound to IChildDefaultInstanceBehaviors\n 12:31 < datakurre> rnix: Well, that works for sure.\n 12:32 < rnix> datakurre: instead of binding the add view by name to Products.CMFCore.interfaces.IFolderish, we bind it to IChildDefaultInstanceBehaviors without name...\n\n\nContributors\n------------\n\n- JC Brand\n- Johannes Raggam\n- Robert Niederreiter\n- Peter Holzer\n\nChangelog\n=========\n\n0.4\n---\n\n- Be more explicit on dependencies and other egg improvements\n [tomgross]\n\n0.3\n---\n\n- Fix ``DexterityInstanceBehaviorAssignable.enumerateBehaviors`` in order to\n work with plone.dexterity >= 2.3.0\n [agitator]\n\n\n0.2\n---\n\n- convert behaviors in ``enable_behaviors`` to tuple before concat.\n [rnix]\n\n- check whether instance behavior already in instance_behaviors before\n adding.\n [rnix]\n\n\n0.1\n---\n\n- created ``collective.instancebehavior`` based on jcbrand's and thet's work\n [rnix]\n\n- improved implementation with generic helper functions\n [thet]\n\n- problem description and initial implementation\n [jcbrand]\n\nLicense\n=======\n\nCopyright (c) 2013, JC Brand, Johannes Raggam, Robert Niederreiter\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this \n list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice, this \n list of conditions and the following disclaimer in the documentation and/or \n other materials provided with the distribution.\n* Neither the name of the BlueDynamics Alliance nor the names of its \n contributors may be used to endorse or promote products derived from this \n software without specific prior written permission.\n \nTHIS SOFTWARE IS PROVIDED BY BlueDynamics Alliance ``AS IS`` AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL BlueDynamics Alliance BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://pypi.python.org/pypi/collective.instancebehavior", "keywords": "Python Plone Dexterity Behavior Development", "license": "GNU General Public Licence", "maintainer": null, "maintainer_email": null, "name": "collective.instancebehavior", "package_url": "https://pypi.org/project/collective.instancebehavior/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/collective.instancebehavior/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://pypi.python.org/pypi/collective.instancebehavior" }, "release_url": "https://pypi.org/project/collective.instancebehavior/0.4/", "requires_dist": null, "requires_python": null, "summary": "Enable behaviors per content type instance.", "version": "0.4" }, "last_serial": 2756825, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "36b570d87a377302a0e31f9cfe391b66", "sha256": "9c52525d02b23b03696ec411998f6be9f68d6abfa03ba4ad4dea392232f0c5a3" }, "downloads": -1, "filename": "collective.instancebehavior-0.1.tar.gz", "has_sig": false, "md5_digest": "36b570d87a377302a0e31f9cfe391b66", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12486, "upload_time": "2013-10-08T08:11:00", "url": "https://files.pythonhosted.org/packages/a4/88/af42d1ec1430adc9e0ca337c33b5185a62046dea450f14bfa8c5f6dcd24c/collective.instancebehavior-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "f8af55761d55b8bc58453a301d235370", "sha256": "4955855a1b3b67e633d781af784aa6058465d9226937a0ec893e5ce844ed7835" }, "downloads": -1, "filename": "collective.instancebehavior-0.2.tar.gz", "has_sig": false, "md5_digest": "f8af55761d55b8bc58453a301d235370", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12613, "upload_time": "2014-04-06T13:06:28", "url": "https://files.pythonhosted.org/packages/3f/5a/a787d0c3c5e7294f7f0cd2b70d0952d236c73f0a3996eb7f16ece2c33930/collective.instancebehavior-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "ca04039b669caeec4197191efdf59c94", "sha256": "9f38492d809f537f9a0492254994fe77f2582ab75eb9362fed0006ecf4b418ec" }, "downloads": -1, "filename": "collective.instancebehavior-0.3.tar.gz", "has_sig": false, "md5_digest": "ca04039b669caeec4197191efdf59c94", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12436, "upload_time": "2014-12-02T08:53:12", "url": "https://files.pythonhosted.org/packages/83/f8/348ae868c57c1edcb7f4a4c81a152f0e6b299d91c3dc77b56221f7c92f12/collective.instancebehavior-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "759bc9029974558b3f692819af120df8", "sha256": "f580ef18f7d87264012e2baca2cb71b90b4160210e5d89f19905008b989ebd39" }, "downloads": -1, "filename": "collective.instancebehavior-0.4.tar.gz", "has_sig": false, "md5_digest": "759bc9029974558b3f692819af120df8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15281, "upload_time": "2017-04-06T06:11:19", "url": "https://files.pythonhosted.org/packages/c2/cc/ddb0c6566064710de2126293801fa8fe0eab46c3c8f7f4fac5e9c1fe20c9/collective.instancebehavior-0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "759bc9029974558b3f692819af120df8", "sha256": "f580ef18f7d87264012e2baca2cb71b90b4160210e5d89f19905008b989ebd39" }, "downloads": -1, "filename": "collective.instancebehavior-0.4.tar.gz", "has_sig": false, "md5_digest": "759bc9029974558b3f692819af120df8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15281, "upload_time": "2017-04-06T06:11:19", "url": "https://files.pythonhosted.org/packages/c2/cc/ddb0c6566064710de2126293801fa8fe0eab46c3c8f7f4fac5e9c1fe20c9/collective.instancebehavior-0.4.tar.gz" } ] }