{ "info": { "author": "Simples Consultoria", "author_email": "products@simplesconsultoria.com.br", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Framework :: Plone", "Framework :: Plone :: 4.1", "Framework :: Plone :: 4.2", "Framework :: Zope2", "License :: OSI Approved :: GNU General Public License (GPL)", "License :: Other/Proprietary License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "collective.grok\n**************************************************************\n\n.. contents:: Table of Contents\n :depth: 2\n\n\nOverview\n===========\n\n**collective.grok** intends to reduce the need for ZCML usage in **Plone**\nprojects.\n\nUsing the infrastructure provided by \n`five.grok `_ and \n`martian `_, this package\nadds new decorators and helper functions to enable Plone developers focus on\nPython code instead of copying and pasting ZCML snippets around.\n\n\ncollective.grok vs five.grok\n------------------------------\n\n**collective.grok** is inspired by five.grok and it complements it and\nin Plone projects you will end using both of them.\n\nfive.grok will take care of grokking Adapters, Subscribers, Utilities, \nViews whilst collective.grok aims for things like Generic Setup, \nInternationalization, Portlets (coming soon!).\n\n\nInstallation\n=============\n\nThis package is intended to be a dependency of other packages, so declare\nit on the **setup.py** of your package, under *install_requires*:\n::\n \n install_requires=[\n 'setuptools',\n # XXX: Add extra requirements here\n 'collective.grok',\n ],\n\n\n.. note:: There is no need to explicitly declare *five.grok* as\n *collective.grok* already does that.\n\nUsage\n===========\n\nIn order to make it *fit your mind* to collective.grok groups its helpers\nin packages according to Plone technologies it addresses, for example,\n*collective.grok.gs* deals with Generic Setup.\n\n\nGeneric Setup\n---------------\n\nThe most commonly used Generic Setup registrations implemented by ZCML are supported in the current release of collective.grok.\n\nRegistering Profiles\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTo register a profile with ZCML you should add the following element to \nconfigure.zcml (or some other file included by it). \n\n::\n\n \n\n\nUsing collective.grok, the same registration would be done (verbosily):\n\n::\n \n from collective.grok import gs\n from Products.GenericSetup.interfaces import EXTENSION\n gs.profile(name=u'default',\n title=u'Portal policy for plone.org',\n description=u'Installs dependencies and stuff for our portal',\n directory='profiles/default',\n provides=EXTENSION)\n\n\nTo register a second profile (in our case, one for uninstall), we would\ndo the same (now, without passing the parameter names):\n\n::\n\n gs.profile(u'uninstall',\n u'Uninstall portal policy for plone.org',\n u'Removes dependencies and stuff from our portal',\n 'profiles/uninstall',\n EXTENSION)\n\nAnd i18n is supported using zope.i18nmessageid MessageFactory. In the\nfollowing profile registration, we translate the profile title and\nits description:\n\n::\n \n from my.package import MessageFactory as _\n gs.profile(u'init',\n _(u'Initial content structure for plone.org'),\n _(u'Constructs folder structure and navigation'),\n 'profiles/init',\n EXTENSION)\n\n\nSince version 1.0a2, the default value for *provides* argument is EXTENSION,\nso you can omit it:\n::\n\n from collective.grok import gs\n \n gs.profile(name=u'default',\n title=u'Portal policy for plone.org',\n description=u'Installs dependencies and stuff for our portal',\n directory='profiles/default')\n\n\nRegistering Export Steps\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nUsing ZCML to register an export step for Generic Setup demanded the\ninclusion of the following element element to configure.zcml (or some other file included by it). \n\n::\n\n \n \n\n\nThe registration points to a handler, which implements the actual export\ncode:\n\n::\n\n def exportArchetypeTool(context):\n \"\"\"Export Archetype Tool configuration.\n \"\"\"\n site = context.getSite()\n logger = context.getLogger(\"archetypetool\")\n tool = getToolByName(site, TOOL_NAME, None)\n if tool is None:\n return\n\n exportObjects(tool, '', context)\n logger.info(\"Archetype tool exported.\")\n\n\n\nGrokking it, the same registration would be done on the\narchetypetool module with an import and a decorator:\n\n::\n \n from collective.grok import gs\n \n @gs.exportstep(name=u'archetypetool', title='Archetype Tool',\n description='Export Archetype Tool.')\n def exportArchetypeTool(context):\n \"\"\"Export Archetype Tool configuration.\n \"\"\"\n site = context.getSite()\n logger = context.getLogger(\"archetypetool\")\n tool = getToolByName(site, TOOL_NAME, None)\n if tool is None:\n return\n\n exportObjects(tool, '', context)\n logger.info(\"Archetype tool exported.\")\n\n\nAgain, you could even omit parameter names if you want...\n\n::\n \n from collective.grok import gs\n \n @gs.exportstep(u'archetypetool','Archetype Tool',\n 'Export Archetype Tool.')\n def exportArchetypeTool(context):\n \"\"\"Export Archetype Tool configuration.\n \"\"\"\n site = context.getSite()\n logger = context.getLogger(\"archetypetool\")\n tool = getToolByName(site, TOOL_NAME, None)\n if tool is None:\n return\n\n exportObjects(tool, '', context)\n logger.info(\"Archetype tool exported.\")\n\n\nRegistering Import Steps\n^^^^^^^^^^^^^^^^^^^^^^^^^\n\nImport Steps are delt similarly to Export Steps. So, ZCML registration\nis done (zcml file):\n\n::\n\n \n \n \n\n\nAnd respective Python Code:\n\n::\n\n def setupArchetypes(context):\n \"\"\"\n Setup Archetypes step.\n \"\"\"\n # Only run step if a flag file is present (e.g. not an extension profile)\n if context.readDataFile('archetypes-various.txt') is None:\n return\n out = []\n site = context.getSite()\n install_uidcatalog(out, site)\n install_referenceCatalog(out, site)\n install_templates(out, site)\n\n\nGrokking it, we would have:\n\n::\n \n from collective.grok import gs\n \n @gs.importstep(name=u'archetypetool', title='Archetype Tool',\n description='Export Archetype Tool.',\n dependecies=['componentregistry',])\n def setupArchetypes(context):\n \"\"\"\n Setup Archetypes step.\n \"\"\"\n # Only run step if a flag file is present (e.g. not an extension profile)\n if context.readDataFile('archetypes-various.txt') is None:\n return\n out = []\n site = context.getSite()\n install_uidcatalog(out, site)\n install_referenceCatalog(out, site)\n install_templates(out, site)\n\n\n\nRegistering Upgrade Steps\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nTo register an upgrade step using ZCML the following slug should be added to\nconfigure.zcml:\n\n::\n\n \n\n\nThe handler code would look like:\n\n::\n\n def to2000(context):\n \"\"\"\n Update portal title \n \"\"\"\n site = context.getSite()\n site.title = u'A New Title'\n\n\ncollective.grok provide a decorator to grok this code:\n\n::\n \n from collective.grok import gs\n \n @gs.upgradestep(title=u'Update portal title',\n description=u'Upgrade step used to update portal title',\n source='1000', destination='2000', sortkey=1,\n profile='my.package:default')\n def to2000(context):\n \"\"\"\n Update portal title \n \"\"\"\n site = context.getSite()\n site.title = u'A New Title'\n\n\ni18n\n---------------\n\nRegistering Translations\n^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nUsing ZCML to register a translation directory for a package:\n\n::\n\n \n\n \n\n\nUsing collective.grok, the same registration would be done:\n\n::\n \n from collective.grok import i18n\n \n i18n.registerTranslations(directory='locales')\n\n\nTODO\n===========\n\n* Portlet registration\n\n* Permission registration\n\n* Transmogrifier support (conditional)\n\n* Behavior registration (Should be in Dexterity?)\n\nCredits\n===========\n\nDevelopment of this product was sponsored by :\n \n * `Simples Consultoria `_.\n\nChangelog\n==========\n\n1.0a2 (2012-04-16)\n------------------\n\n* Changed gs.profile provides argument from BASE to EXTENSION as it is the\n most common use case for product developers (danke davilima6) [ericof]\n\n\n1.0a1 (2012-04-14)\n------------------\n\n* Generic Setup: Register Profile [ericof]\n\n* Generic Setup: Register Import Step [ericof]\n\n* Generic Setup: Register Export Step [ericof]\n\n* Generic Setup: Register Upgrade Step [ericof]\n\n* i18n: Register Translations [ericof]\n\n* Initial release [ericof]", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.simplesconsultoria.com.br", "keywords": "plone zope grok generic_setup i18n", "license": "gpl", "maintainer": null, "maintainer_email": null, "name": "collective.grok", "package_url": "https://pypi.org/project/collective.grok/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/collective.grok/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://www.simplesconsultoria.com.br" }, "release_url": "https://pypi.org/project/collective.grok/1.0a2/", "requires_dist": null, "requires_python": null, "summary": "Configuring and registering Plone components, w/o ZCML", "version": "1.0a2" }, "last_serial": 787834, "releases": { "1.0a1": [ { "comment_text": "", "digests": { "md5": "5f68e52f5ee3b1225459be32d2791627", "sha256": "555b486768bb78478e560ac0dd479c8b7485fbbce9b8345a9aad660df4dabdfe" }, "downloads": -1, "filename": "collective.grok-1.0a1.tar.gz", "has_sig": false, "md5_digest": "5f68e52f5ee3b1225459be32d2791627", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19928, "upload_time": "2012-04-14T05:23:10", "url": "https://files.pythonhosted.org/packages/d8/c8/815e7fd67f78cbadc63be1abd0046fc4952a6dd6e6d27110b1ed472926e0/collective.grok-1.0a1.tar.gz" } ], "1.0a2": [ { "comment_text": "", "digests": { "md5": "7261464f37c72844aab0ab66a994f065", "sha256": "2303a51f800133c568229b916eac373c667c6a28f86030ddfd1e8a0638c4a336" }, "downloads": -1, "filename": "collective.grok-1.0a2.tar.gz", "has_sig": false, "md5_digest": "7261464f37c72844aab0ab66a994f065", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20326, "upload_time": "2012-04-17T03:27:04", "url": "https://files.pythonhosted.org/packages/14/6a/106eb66a4ba54ab5ae28c16209e182ccd10c27311058222d033ea2530e48/collective.grok-1.0a2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7261464f37c72844aab0ab66a994f065", "sha256": "2303a51f800133c568229b916eac373c667c6a28f86030ddfd1e8a0638c4a336" }, "downloads": -1, "filename": "collective.grok-1.0a2.tar.gz", "has_sig": false, "md5_digest": "7261464f37c72844aab0ab66a994f065", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20326, "upload_time": "2012-04-17T03:27:04", "url": "https://files.pythonhosted.org/packages/14/6a/106eb66a4ba54ab5ae28c16209e182ccd10c27311058222d033ea2530e48/collective.grok-1.0a2.tar.gz" } ] }