{ "info": { "author": "JC Brand, Syslab.com GmbH", "author_email": "brand@syslab.com", "bugtrack_url": null, "classifiers": [ "Framework :: Plone", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Full readme and doctests in slc/autocategorize/README.txt\n\nIntroduction\n============\n\nslc.autocategor\u0456ze enables you to let the objects created inside a folder\nautomatically receive the same categories metadata as the folder itself.\n\nThe contained objects receive the same categorization of the folder when they \nare created. The effect is not retroactive though, and when you change the\ncategories on a folder, the contained objects will not be re-categorized.\n\nHow it works:\n-------------\nThis product add a boolean field 'autoCategorizeContent' on all BaseFolder\nbased folders. When this field is set to true for a certain folder, all \nthe objects created in that folder will receive the folder's categories (the\nvalue of the 'subject' field) in addition to any categories manually set on the\nobject.\n\nThe 'autoCategorizeNewContent' and 'recursiveAutoCategorization' fields are added \nto the BaseFolder schema via a schema-extender adapter. You can override this \nadapter in your own product to be applicable to another Archetype class if\nnecessary*. \n\n*See slc.autocategorize.configure.py*\n \nHow To Use (Simple DocTests):\n=============================\n\nFirst we create a folder whose children we want to be categorized\nautomatically:\n\n >>> self.folder.invokeFactory('Folder', 'documents')\n 'documents'\n >>> folder = self.folder._getOb('documents')\n\nTo enable the auto-categorization feature, we must set the 'autoCategorizeContent' \nfield on the parent folder. \n\nThis is a field added via schema-extension, so we cannot use an Archetypes\ngenerated mutator.\n\n >>> folder.Schema().get('autoCategorizeNewContent').set(folder, True)\n\nLet's categorize our folder:\n\n >>> folder.setSubject(['foo', 'bar', 'baz'])\n\nWe now create a document inside this folder and test whether it has\nbeen given the same 'subject' values:\n\n >>> folder.invokeFactory('Document', 'document1')\n 'document1'\n >>> d1 = folder.get('document1')\n\nNormally, when you created an Archetypes object in Plone, the\nObjectInitializedEvent is called. slc.autocategorize uses this event to know\nwhen a new object has been created. \n\nHere we have to do it manually:\n\n >>> from zope import event\n >>> from Products.Archetypes.event import ObjectInitializedEvent\n >>> event.notify(ObjectInitializedEvent(d1))\n\nNow we test that the folder's categories have been added:\n\n >>> d1.Subject()\n ('foo', 'bar', 'baz')\n\nLet's also make sure that existing categories on a document are not deleted\nwhen it receives new ones from it's parent folder. We also want to be sure that\nwhen the child object already has one of the categories of the parent, that\nit is not duplicated during the autocategorization process:\n\nFirst we create the new object:\n\n >>> folder.invokeFactory('Document', 'document2')\n 'document2'\n\nThen we set the categories:\n\n >>> d2 = folder.get('document2')\n >>> d2.setSubject(['baz', 'buz'])\n\nThen we call the event to notify slc.autocategorized that an object was created\n(in Plone this happens automatically):\n\n >>> from Products.Archetypes.event import ObjectInitializedEvent\n >>> event.notify(ObjectInitializedEvent(d2))\n\nLet's test that the categories are as expected:\n\n >>> d2.Subject()\n ('baz', 'buz', 'foo', 'bar')\n\nFinally, we test that the 'recursive autocategor\u0456zation' feature works.\nFirst we create a subfolder and inside that folder another document:\n\n >>> folder.invokeFactory('Folder', 'sub-folder')\n 'sub-folder'\n >>> subfolder = folder.get('sub-folder')\n >>> subfolder.invokeFactory('Folder', 'document3')\n 'document3'\n\nAgain we have to call the appropriate event:\n\n >>> d3 = subfolder.get('document3')\n >>> event.notify(ObjectInitializedEvent(d3))\n\nAnd now we make sure that now categories were set yet, since the recurse\nfeature was not yet activated:\n\n >>> d3.Subject()\n ()\n\nOk, so let's now activate recursion:\n\n >>> folder.Schema().get('recursiveAutoCategorization').set(folder, True)\n\nThen we create a new document:\n\n >>> subfolder.invokeFactory('Folder', 'document4')\n 'document4'\n >>> d4 = subfolder.get('document4')\n >>> event.notify(ObjectInitializedEvent(d4))\n\nand test that the categories were set correctly:\n\n >>> d4.Subject()\n ('foo', 'bar', 'baz')\n\n\n\n\nChangelog\n=========\n\n0.2 (2012-03-21)\n----------------\n\n- Bugfix. Don't break when a dexterity object is one of the parents. [jcbrand]\n\n\n0.1 (2011-09-13)\n----------------\n\n- Tested for Plone 4.1\n\n0.1b1 (2010-03-04)\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://svn.plone.org/svn/plone/plone.example", "keywords": "", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "slc.autocategorize", "package_url": "https://pypi.org/project/slc.autocategorize/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/slc.autocategorize/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://svn.plone.org/svn/plone/plone.example" }, "release_url": "https://pypi.org/project/slc.autocategorize/0.2/", "requires_dist": null, "requires_python": null, "summary": "Automatically inherit the parent folder's categories when you create an object.", "version": "0.2" }, "last_serial": 799666, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "72d9cfee1a3d3929262210e41dde407a", "sha256": "f6b4414e34f0b5e1fc7fa8c162739f741a416c0271f819d3440cfd13ba2a010d" }, "downloads": -1, "filename": "slc.autocategorize-0.1.tar.gz", "has_sig": false, "md5_digest": "72d9cfee1a3d3929262210e41dde407a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14352, "upload_time": "2011-09-13T15:36:05", "url": "https://files.pythonhosted.org/packages/f5/25/2144d8f13e4e097859965090ac97ae489b44650e74e0303b48f71a82fd7a/slc.autocategorize-0.1.tar.gz" } ], "0.1b1": [ { "comment_text": "", "digests": { "md5": "5e709ff50e80856b50033e0c6c0d285a", "sha256": "ee110ecf90c1ff8e80c4c95b43dd703d37d39331598e7e7fcb29a6665eaf96a0" }, "downloads": -1, "filename": "slc.autocategorize-0.1b1.zip", "has_sig": false, "md5_digest": "5e709ff50e80856b50033e0c6c0d285a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21907, "upload_time": "2010-03-04T17:31:46", "url": "https://files.pythonhosted.org/packages/cf/5b/48d6b10949b8389d05e3bd8cf020ab778e5086989d4bcc9ddd8ba954b52d/slc.autocategorize-0.1b1.zip" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "324ee3dec32e036e3e7b91d5144f7924", "sha256": "862b206b92d78aa2146b1d0c2ca2b95ebd82a448764e577426f4a9641db1500a" }, "downloads": -1, "filename": "slc.autocategorize-0.2.zip", "has_sig": false, "md5_digest": "324ee3dec32e036e3e7b91d5144f7924", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22538, "upload_time": "2012-03-21T18:33:48", "url": "https://files.pythonhosted.org/packages/20/8b/0d9230050c62b21666a1b4c04c1a607c1f528e7b77b0b54bac89e3669667/slc.autocategorize-0.2.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "324ee3dec32e036e3e7b91d5144f7924", "sha256": "862b206b92d78aa2146b1d0c2ca2b95ebd82a448764e577426f4a9641db1500a" }, "downloads": -1, "filename": "slc.autocategorize-0.2.zip", "has_sig": false, "md5_digest": "324ee3dec32e036e3e7b91d5144f7924", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22538, "upload_time": "2012-03-21T18:33:48", "url": "https://files.pythonhosted.org/packages/20/8b/0d9230050c62b21666a1b4c04c1a607c1f528e7b77b0b54bac89e3669667/slc.autocategorize-0.2.zip" } ] }