{ "info": { "author": "Mathieu Pasquet", "author_email": "kiorky@cryptelium.net", "bugtrack_url": null, "classifiers": [ "Framework :: Plone", "Framework :: Zope2", "Framework :: Zope3", "Programming Language :: Python", "Programming Language :: Zope", "Topic :: Software Development", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Introduction\n=============\n\n This package enables the use of z3c forms in grok.View style inside a plone environment.\n\n Note that you have two wrappers and a basic form class:\n\n - *FormWrapper* to use the basic ``z3c.form`` template\n - *PloneFormWrapper* is a basic z3c.form wrapper with some plone integration (fieldsets & kss) (from ``plone.app.z3cform``)\n - *PloneForm* is a basic z3c.form with some plone integration (fieldsets & groups) (from plone.app.z3cform)\n - A *TestCase* to test your code with z3cform.grok with either using directly itself or by sublassing it\n\n.. contents::\n\nCredits\n======================================\n|makinacom|_\n\n* `Planet Makina Corpus `_\n* `Contact us `_\n\n.. |makinacom| image:: http://depot.makina-corpus.org/public/logo.gif\n.. _makinacom: http://www.makina-corpus.com\n\nBasic Usage\n=============\n\nDeclare a form in 'foo.py' module\n::\n\n\n >>> import plone.z3cform.fieldsets.extensible.ExtensibleForm$\n >>> import z3c.form.form.Form\n >>> class Myform(plone.z3cform.fieldsets.extensible.ExtensibleForm, z3c.form.form.Form):\n ... \"\"\"A z3c.form\"\"\"\n ... ingoreContext = True or False # override me\n\nNote that ``collective.z3cform.grok.grok.PloneForm`` is a shortcut to the previous declaration, see implementation.\n\nThen a Wrapper\n::\n\n >>> from collective.z3cform.grok.grok import PloneFormWrapper\n >>> class myview(PloneFormWrapper):\n ... form = Myform\n\n\nWrite a basic template, in foo_templates/myview.py, for example:\n::\n\n \n \n \n \n \n \n \n \n \n\n\nEt voila, you can access your form @\n\n - http://url/@@myview\n\nBasic grok testing in a third party package\n=============================================\n\nImport the basic testcase\n::\n\n >>> from collective.z3cform.grok.tests.test_doctests import DocTestCase as dt\n >>> from collective.z3cform.grok.tests.test_doctests import collective_z3cform_grok_setUp\n >>> from collective.z3cform.grok.tests.test_doctests import collective_z3cform_grok_tearDown\n\nCompose a testcase with one of your favourite testcases\n::\n\n >>> class DocTestCase(MyFunctionalTestCase, dt):\n ... def setUp_hook(self, *args, **kwargs):\n ... MyFunctionalTestCase.setUp(self)\n ... def tearDown_hook(self, *args, **kwargs):\n ... MyFunctionalTestCase.tearDown(self)\n ... def afterSetUp(self):\n ... \"\"\".\"\"\"\n ... MyFunctionalTestCase.afterSetUp(self)\n ...\n\nMake a doc_suite soap assembling the whole\n::\n\n >>> def test_doctests_suite(directory=None, globs=None, suite=None, testklass=None):\n ... if not testklass: testklass=DocTestCase\n ... if not directory:\n ... directory, _f = os.path.split(os.path.abspath(__file__))\n ... elif os.path.isfile(directory):\n ... directory = os.path.dirname(directory)\n ... files = [os.path.join(directory, f) for f in os.listdir(directory)\n ... if f.endswith('.txt')]\n ... if not globs:\n ... globs={}\n ... g = globals()\n ... for key in g:\n ... globs.setdefault(key, g[key])\n ... directory = directory\n ...\n ... if not suite:\n ... suite = unittest.TestSuite()\n ... if files:\n ... options = doctest.REPORT_ONLY_FIRST_FAILURE |\\\n ... doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS\n ... for test in files:\n ... ft = ztc.ZopeDocFileSuite(\n ... test,\n ... test_class=testklass,\n ... optionflags=options,\n ... globs=globs,\n ... setUp=collective_z3cform_grok_setUp,\n ... tearDown=collective_z3cform_grok_tearDown,\n ... module_relative = False,\n ... )\n ... suite.addTest(ft)\n ... return suite\n >>> def test_suite():\n ... \"\"\".\"\"\"\n ... suite = unittest.TestSuite()\n ... return test_doctests_suite(suite=suite)\n\n\n Et voila, all files ending with txt in the tests directory will be tested with that magic TestCase.\n\n\n\n\n\nUsing grok.View to display z3c.forms in plone\n========================================================\n\nThe goal of this package was to make a very minimal integration of z3c.form and plone.\nFar from plone.app.directive, my goal was to be light.\n\nDo a simple naming schema\n::\n\n <<< import collective;from five import grok\n <<< import zope, z3c\n <<< class IMyFormSchema(zope.interface.Interface):\n ... name = zope.schema.Text(title=u\"Name\", description = u'Name', required=False)\n <<< class MyForm(z3c.form.form.Form):\n ... ignoreContext = True\n ... fields = z3c.form.field.Fields(IMyFormSchema)\n ... @z3c.form.button.buttonAndHandler(u'Ok', name='Ok')\n ... def ok(self, action, *args, **kwargs):\n ... msg = u'me Grok NameField <> @name == %s' % self.widgets['name'].value\n ... from Products.statusmessages.interfaces import IStatusMessage\n ... IStatusMessage(self.request).addStatusMessage(msg, type='info')\n\nThe grok.View wrapping form can be looking like that\n::\n\n <<< class myview(collective.z3cform.grok.grok.FormWrapper):\n ... grok.context(zope.interface.Interface)\n ... form = MyForm\n\nNote that this grok style class support those attributes:\n\n - layer: the Form Layer\n - Any grok directive (require, template, context, etc.)\n - form: The form class\n - Think that you can add some directives also on your form like ignoreContext\n\n- As we know how grok works, telling that we want an Interface as a context says that this form applys everywhere.\n- ``ignoreContext`` is used just to drop context mapping.\n- All that we have to do now is to instantiate and render our view and our form.\n And with grok magic, the view is already registered on our portal\n Note that its template will automaticly resolve to ``module_templates/lower_view_name.pt``, and here: ``form_templates/bar.bt``\n\n::\n\n >>> request = make_request()\n >>> interface.alsoProvides(request, z3c.form.interfaces.IFormLayer)\n >>> interface.alsoProvides(request, zope.annotation.interfaces.IAttributeAnnotatable)\n >>> pv = getMultiAdapter((portal, request), name='myview')\n >>> pv.template.__grok_location__.endswith('form_templates/myview.pt')\n True\n >>> print open(pv.template.__grok_location__).read()\n \n \n \n \n

my grokky template

\n

The form is:

\n \n
\n
\n \n \n \n\nWe need to call the update method to manually trigger the form.update() process\n::\n\n >>> pv.compute_widgets()\n >>> print '\\n'.join([a.rstrip() for a in pv.render_form().split('\\n') if a.strip()])\n
\n
\n
\n \n
Name
\n
\n \n
\n
\n
\n
\n \n
\n
\n >>> pv.__class__\n \n\nVerify the authenticity of our grok.View\n::\n\n >>> from zope.interface.verify import verifyObject\n >>> from grokcore.view.interfaces import IGrokView\n >>> pv.request is request\n True\n >>> verifyObject(IGrokView, pv)\n True\n\nWe can also test that all is in place through the web and that our view is registered and the ``switch_on`` cruft works. Note that it uses the plone.app.z3cform ``form.pt`` template.\n::\n\n >>> browser.open(portal.absolute_url()+\"/@@myview\")\n >>> print '\\n'.join([a.rstrip() for a in browser.contents.split('\\n') if a.strip()])\n <...

my grokky template

...

The form is:

\n ...

\n ...
...\n\nTesting that the form submission & actions are working\n::\n\n >>> browser.handleErrors = False\n >>> browser.open(portal.absolute_url()+\"/@@myview\")\n >>> browser.getControl(name='form.widgets.name').value = 'foo'\n >>> browser.getControl(name='form.buttons.Ok').click()\n >>> browser.url\n 'http://nohost/plone/@@myview'\n >>> 'class=\"textarea-widget text-field\">foo' in browser.contents\n True\n\nOpening again with our StatusMessage cookie which has been set by previous request\n::\n\n >>> '
me Grok NameField <> @name == foo
' in browser.contents\n True\n\n\n\ncollective.z3cform.grok Installation\n==============================================\n\nTo install collective.z3cform.grok into the global Python environment (or a workingenv),\nusing a traditional Zope 2 instance, you can do this:\n\n * When you're reading this you have probably already run \n ``easy_install collective.z3cform.grok``. Find out how to install setuptools\n (and EasyInstall) here:\n http://peak.telecommunity.com/DevCenter/EasyInstall\n\n * If you are using Zope 2.9 (not 2.10), get `pythonproducts`_ and install it \n via::\n\n python setup.py install --home /path/to/instance\n\n into your Zope instance.\n\n * Create a file called ``collective.z3cform.grok-configure.zcml`` in the\n ``/path/to/instance/etc/package-includes`` directory. The file\n should only contain this::\n\n \n\n.. _pythonproducts: http://plone.org/products/pythonproducts\n\n\nAlternatively, if you are using zc.buildout and the plone.recipe.zope2instance\nrecipe to manage your project, you can do this:\n\n * Add ``collective.z3cform.grok`` to the list of eggs to install, e.g.::\n \n [buildout]\n ...\n eggs =\n ...\n collective.z3cform.grok\n \n * Tell the plone.recipe.zope2instance recipe to install a ZCML slug::\n \n [instance]\n recipe = plone.recipe.zope2instance\n ...\n zcml =\n collective.z3cform.grok\n \n * Re-run buildout, e.g. with::\n \n $ ./bin/buildout\n \nYou can skip the ZCML slug if you are going to explicitly include the package\nfrom another package's configure.zcml file.\n\n\n\nChangelog\n=========\n\n1.15 (2012-08-08)\n-----------------\n - fix utf-8 header\n - fix interfaces import\n\n - remove useless dependencies\n \n - changed plone.z3cform.z2.decode in grok.py to reflect the existing plone.z3cform - maybe was a version difference [miohtama]\n\n\n1.10\n----\n\n - Add other forms helpers (contextless, subform)\n - Externalize some glue to deal with zope2 requests for reuse in other code.\n\n1.9\n-----\n\n - remove useless call\n\n1.6 - 1.7 - 1.8\n------------------\n\n - rework the tests infra.\n\n1.4-1.5\n---------\n\n - fix packaing & reload function\n\n1.3\n-----\n\n - add plone form\n - yet better support for layers\n\n1.2\n-----\n\n - handle better group forms and layers\n\n1.1\n----\n\n * bugfix: misunderstood something about the form.updateWidgets method.\n\n1.0\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/collective/collective.z3cform.grok", "keywords": "", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "collective.z3cform.grok", "package_url": "https://pypi.org/project/collective.z3cform.grok/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/collective.z3cform.grok/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://svn.plone.org/svn/collective/collective.z3cform.grok" }, "release_url": "https://pypi.org/project/collective.z3cform.grok/1.15/", "requires_dist": null, "requires_python": null, "summary": "A small integration of z3cform using grok magic on plone by Makina Corpus.", "version": "1.15" }, "last_serial": 788290, "releases": { "1.0dev-r99738": [ { "comment_text": "", "digests": { "md5": "9eb21b2b5038cf50a2f1d501151467f5", "sha256": "63f7af143d6979b68c27565d3202c0d891cb639e54538b2cb7574ecc27308f37" }, "downloads": -1, "filename": "collective.z3cform.grok-1.0dev-r99738.zip", "has_sig": false, "md5_digest": "9eb21b2b5038cf50a2f1d501151467f5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27333, "upload_time": "2009-10-18T17:48:51", "url": "https://files.pythonhosted.org/packages/ab/5d/0b9f11ef30fdf0afef67669251a9d3a3b350fa97209f33342ab06d6a14d4/collective.z3cform.grok-1.0dev-r99738.zip" } ], "1.10": [ { "comment_text": "", "digests": { "md5": "d9a653ab05352c8499f56af8bf50284d", "sha256": "a3b5a0ee8d7862074502c2b82e5c7799407b63055e3c820becf3d86cadd1b073" }, "downloads": -1, "filename": "collective.z3cform.grok-1.10.zip", "has_sig": false, "md5_digest": "d9a653ab05352c8499f56af8bf50284d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37322, "upload_time": "2009-10-30T02:29:28", "url": "https://files.pythonhosted.org/packages/6b/6d/938922df5be7dc3b64ab54e5972436edfe08e40b43696070d06314accaf4/collective.z3cform.grok-1.10.zip" } ], "1.11": [ { "comment_text": "", "digests": { "md5": "b5e181f09bc35403b43ab6d767979262", "sha256": "2a092e3ac74bf38a848b562408fb587c3f98d67b725f67eaee1addb716a20cb5" }, "downloads": -1, "filename": "collective.z3cform.grok-1.11.zip", "has_sig": false, "md5_digest": "b5e181f09bc35403b43ab6d767979262", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37272, "upload_time": "2009-11-02T00:20:41", "url": "https://files.pythonhosted.org/packages/26/f9/35bd45be6bc54133c450b929a56b2d7ea11081a462c9c17951c13bf773fd/collective.z3cform.grok-1.11.zip" } ], "1.12": [ { "comment_text": "", "digests": { "md5": "68ff4121fa0345efd232fc56689a6d23", "sha256": "be56fa9a925f14103d3af3599aa1eed28e582e5ba19819d51cb1d66a926b9c1b" }, "downloads": -1, "filename": "collective.z3cform.grok-1.12.zip", "has_sig": false, "md5_digest": "68ff4121fa0345efd232fc56689a6d23", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37276, "upload_time": "2009-11-04T15:34:29", "url": "https://files.pythonhosted.org/packages/3e/20/674543e85ceb2d67bdbc53ce25812ee8844afd0bc33461f260c7475a4d2b/collective.z3cform.grok-1.12.zip" } ], "1.13": [ { "comment_text": "", "digests": { "md5": "6db8b7fa4e0dcc24246b2403fab412fd", "sha256": "ecd4392e6475c485366bb43cedc123a66c37e96d5b311cc26bdf0fea846bd5bb" }, "downloads": -1, "filename": "collective.z3cform.grok-1.13.zip", "has_sig": false, "md5_digest": "6db8b7fa4e0dcc24246b2403fab412fd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37017, "upload_time": "2009-11-05T17:32:51", "url": "https://files.pythonhosted.org/packages/95/c0/8c433bfe7ca41a9fc23f6303f03860a8f8077f5da9e0f3dd3d2ba9fdc492/collective.z3cform.grok-1.13.zip" } ], "1.14": [ { "comment_text": "", "digests": { "md5": "e7dd848a392abd1739d265aa13344242", "sha256": "fc30a3b9af4c33537df61c98754ebfbaca5292bbc5089be4e2446e854f81edbf" }, "downloads": -1, "filename": "collective.z3cform.grok-1.14.zip", "has_sig": false, "md5_digest": "e7dd848a392abd1739d265aa13344242", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 37044, "upload_time": "2009-11-05T19:26:56", "url": "https://files.pythonhosted.org/packages/a4/08/603f871cc1056d1b29c2d71fdfd96a57b727472744730f5a066e2de8e0ef/collective.z3cform.grok-1.14.zip" } ], "1.15": [ { "comment_text": "", "digests": { "md5": "f49d0efc7c9ae3b3c6a0008711bdfbf5", "sha256": "dead946aae894ef3a9448cf9c860555ad40b49b59568da170d341c784f257a20" }, "downloads": -1, "filename": "collective.z3cform.grok-1.15.zip", "has_sig": false, "md5_digest": "f49d0efc7c9ae3b3c6a0008711bdfbf5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38092, "upload_time": "2012-08-08T15:45:57", "url": "https://files.pythonhosted.org/packages/4c/e9/bcd836e67b52d715fa032160a40811c1998fc5b4982daff6c772dcd6a744/collective.z3cform.grok-1.15.zip" } ], "1.1dev-r99760": [ { "comment_text": "", "digests": { "md5": "5afd50c430b7a19c06fe0ae2b2857ef7", "sha256": "7b10b1edcaaad0c3bce8bf4687fa75326c561d59bf809e3f7f5db01f69efd5ad" }, "downloads": -1, "filename": "collective.z3cform.grok-1.1dev-r99760.zip", "has_sig": false, "md5_digest": "5afd50c430b7a19c06fe0ae2b2857ef7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27698, "upload_time": "2009-10-18T22:36:49", "url": "https://files.pythonhosted.org/packages/bd/a5/e88c1b03c2df61a4efa4d173a35b477edcd56de26e4644f71489edd5d1c1/collective.z3cform.grok-1.1dev-r99760.zip" } ], "1.2dev-r99760": [ { "comment_text": "", "digests": { "md5": "9c98bd777b38f1d2d96b34098e34690f", "sha256": "a975a9dab8271db7341a5e0e59bc7dbb9c2a5c7178cc9c52891f5a2481be2bb6" }, "downloads": -1, "filename": "collective.z3cform.grok-1.2dev-r99760.zip", "has_sig": false, "md5_digest": "9c98bd777b38f1d2d96b34098e34690f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27884, "upload_time": "2009-10-21T05:37:26", "url": "https://files.pythonhosted.org/packages/20/59/351cfb8a118f9b1d71c4b65fac8e86205d69d0059d93d0e1f7820d2aaee3/collective.z3cform.grok-1.2dev-r99760.zip" } ], "1.3dev-r99760": [ { "comment_text": "", "digests": { "md5": "bb4ee6125f16b426125f0e799cd0820b", "sha256": "3efb0d1cbe38ac695b6512e9649df8ce3bd66577cd1b769ec36831f13a9cdb78" }, "downloads": -1, "filename": "collective.z3cform.grok-1.3dev-r99760.zip", "has_sig": false, "md5_digest": "bb4ee6125f16b426125f0e799cd0820b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30141, "upload_time": "2009-10-21T14:37:21", "url": "https://files.pythonhosted.org/packages/c3/3b/7ca0e86cea57493a8689ed7843da5efe5333d4c4a215c8a3f3d068190418/collective.z3cform.grok-1.3dev-r99760.zip" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "0f4f7c5fde0d34df41956b29ddd87ae4", "sha256": "d2887284c5e605f066f8e107d7f0b4925b0900058059088b34c3dad4cb4d19f7" }, "downloads": -1, "filename": "collective.z3cform.grok-1.4.zip", "has_sig": false, "md5_digest": "0f4f7c5fde0d34df41956b29ddd87ae4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31430, "upload_time": "2009-10-21T20:33:20", "url": "https://files.pythonhosted.org/packages/d3/dd/7a2c33c5ed421854e698f934e590b5bc66c80656009eead64db084c1551c/collective.z3cform.grok-1.4.zip" } ], "1.6": [ { "comment_text": "", "digests": { "md5": "dad733dfd3b21ae4476cb737cf678285", "sha256": "4cfb440be492436b20c54566d5ce3872268f6a6776c31542b516a07d5a620cb5" }, "downloads": -1, "filename": "collective.z3cform.grok-1.6.zip", "has_sig": false, "md5_digest": "dad733dfd3b21ae4476cb737cf678285", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32592, "upload_time": "2009-10-22T13:22:08", "url": "https://files.pythonhosted.org/packages/1f/54/8c44e34e612133276141c416cc1131814a1dae155fce7befce63418f874b/collective.z3cform.grok-1.6.zip" } ], "1.7": [ { "comment_text": "", "digests": { "md5": "27b681da4b81143c26cdeddad8536c47", "sha256": "a0a0b00472f853794db1080a3b1c0a84fdee4ad0d7d02ec2f76bf695043f812d" }, "downloads": -1, "filename": "collective.z3cform.grok-1.7.zip", "has_sig": false, "md5_digest": "27b681da4b81143c26cdeddad8536c47", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36384, "upload_time": "2009-10-22T19:22:40", "url": "https://files.pythonhosted.org/packages/8c/8f/c48873ad1c6fa0fa78bc9b5a8bd398cdd11d882d06e86ce8ca12ab696ba2/collective.z3cform.grok-1.7.zip" } ], "1.8": [ { "comment_text": "", "digests": { "md5": "e68fa139456d00862a2839056a7795fa", "sha256": "5e53577b9b4417fab58b20c2e2ed745547ce0fccf800fcc6acb5d36575533e8a" }, "downloads": -1, "filename": "collective.z3cform.grok-1.8.zip", "has_sig": false, "md5_digest": "e68fa139456d00862a2839056a7795fa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36440, "upload_time": "2009-10-23T09:40:21", "url": "https://files.pythonhosted.org/packages/60/01/2e10f0d5c2d73d9cff26d4c82bf366f0cfe5838b38505f937fe5cee63d80/collective.z3cform.grok-1.8.zip" } ], "1.9": [ { "comment_text": "", "digests": { "md5": "e672d5d63b6f62e3396be0e97f0d3d01", "sha256": "e1b4a83432da6c860225430037d53dd413decfb1f50683568468636a36f5005b" }, "downloads": -1, "filename": "collective.z3cform.grok-1.9.zip", "has_sig": false, "md5_digest": "e672d5d63b6f62e3396be0e97f0d3d01", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36646, "upload_time": "2009-10-26T00:26:14", "url": "https://files.pythonhosted.org/packages/06/77/196504258547d6277f79f983afb5bb81b5c459c992d27b426f6e6a44af18/collective.z3cform.grok-1.9.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f49d0efc7c9ae3b3c6a0008711bdfbf5", "sha256": "dead946aae894ef3a9448cf9c860555ad40b49b59568da170d341c784f257a20" }, "downloads": -1, "filename": "collective.z3cform.grok-1.15.zip", "has_sig": false, "md5_digest": "f49d0efc7c9ae3b3c6a0008711bdfbf5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 38092, "upload_time": "2012-08-08T15:45:57", "url": "https://files.pythonhosted.org/packages/4c/e9/bcd836e67b52d715fa032160a40811c1998fc5b4982daff6c772dcd6a744/collective.z3cform.grok-1.15.zip" } ] }