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.

Fields

  • 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

Widgets

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

Installation

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:

install_requires=['setuptools',
                  'grok',
                  'megrok.form',
                  # 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:

<zodb>
  <blobstorage>
    <filestorage>
      path /path_to_your_app/parts/data/Data.fs
    </filestorage>
    blob-dir /path_to_your_app/parts/data/blobs
  </blobstorage>
</zodb>

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

Authors

  • 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.

Source Distribution

megrok.form-0.2.5.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

megrok.form-0.2.5-py2.4.egg (20.9 kB view details)

Uploaded Egg

File details

Details for the file megrok.form-0.2.5.tar.gz.

File metadata

  • Download URL: megrok.form-0.2.5.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for megrok.form-0.2.5.tar.gz
Algorithm Hash digest
SHA256 1e1874c3b2b5613828c4e2fae8e80e9df0216755ee4f1915915a07e52a16d783
MD5 5008c6e523187417e4e080de36dc1aa2
BLAKE2b-256 61fc6d040f88fce3008136b225df301197439d160bc636198d49ce68fd272ffa

See more details on using hashes here.

File details

Details for the file megrok.form-0.2.5-py2.4.egg.

File metadata

File hashes

Hashes for megrok.form-0.2.5-py2.4.egg
Algorithm Hash digest
SHA256 e313e06fb93807f99133f9d95e11c2ebe461a729e425c3ab4259b2dfe91a2c96
MD5 c55d7c80c963b511ec6e8fd0add3e47e
BLAKE2b-256 291c0bf84273cb45b3b89d9992106baf5679c1c573aac5c7828ee0055c72d20f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page