Skip to main content

Fields, Widgets and Constraints for Grok

Project description

megrok.form is a helper package that provides some useful fields, widgets and constraints for Grok.


  • Email, a TextLine field with a default contraint
  • HTML, a Text field that uses z3c.widget.tiny
  • File, from collective.namedfile
  • Image, from collective.namedfile
  • BlobFile, from collective.namedblobfile
  • BlobImage, from collective.namedblobfile


megrok.form overrides the default widgets for:

  • zope.interface.schema.Date (using zc.datetimewidget.widget.DateWidget)
  • zope.interface.schema.Datetime (using zc.datetimewidget.widget.DatetimeWidget)

And add new widgets for Image and File (from collective.namedfile).

Validators / Constraints

megrok.form add constraints for:

  • SSN
  • US Phone Numbers
  • International Phone Numbers
  • Zip Code
  • URL
  • Email


To use megrok.form under Grok all you need is to install megrok.form as an egg and include it’s zcml. The best place to do this is to make megrok.form a dependency of your application by adding it to your install_requires list in setup.cfg. If you used grokprojet to create your application setup.cfg is located in the project root. It should look something like this:

                  # Add extra requirements here

Then include megrok.form in your configure.zcml. If you used grokproject to create your application it’s at src/<projectname>/configure.zcml. Add the include line after the include line for grok, but before the grokking of the current package. It should look something like this:

<include package="grok" />
<include package="megrok.form" />
<grok:grok package="." />

Then run bin/buildout again. You should now see buildout saying something like:

Getting distribution for 'megrok.form'.
Got megrok.form 0.2.2.

That’s all.

Using Blob Storage

To use blob storage you need to change zodb definition in your parts/zopectl/zope.conf like this:

      path /path_to_your_app/parts/data/Data.fs
    blob-dir /path_to_your_app/parts/data/blobs

The blob-dir specifies where you want to store blobs.


  • Dirceu Pereira Tiegs (dirceutiegs at gmail dot com)

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for megrok.form, version 0.2.5
Filename, size File type Python version Upload date Hashes
Filename, size megrok.form-0.2.5-py2.4.egg (20.9 kB) File type Egg Python version 2.4 Upload date Hashes View hashes
Filename, size megrok.form-0.2.5.tar.gz (9.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page