A set of Archetype validators for Plone, some for Italian specific needs, others useful for all
Project description
Introduction
This product add to Plone some additional validators.
Some of theme can be useful only for Italian users or sites targeted on Italy (as many of the default ones like isSSN``or ``isUSPhoneNumber are not useful for non-US sites), other are simply additional validators that everyone can find useful.
The idea behind the product is simply collect a set of validators that commonly are putted inside other products, but in this way not easily reusable.
Italian Specific validators
isCAP
Very similar to the native isZipCode but this only accept 5 digits values. Formally is Codice di Avviamento Postale.
isItalianNIN
Check if a string is a valid Italian National Insurance Number (“Codice Fiscale”). The validator only check the format of the string, not if the string itself is a real and existing code.
General purpose validators
MinCharsValidator
This validator test if the given value is at least a specific number of characters long. The default character value is 500.
The validator will also ignore any whitespace (space character, carriage return, tab…) so the text:
Hello World
is long like:
Hello World
and also long like:
Hello World
How to use
An example:
from collective.itvalidators.validators import MinCharsValidator ... TextField('text', validators = (MinCharsValidator()), ),
To customize the number of characters:
TextField('text', validators = (MinCharsValidator(100)), ),
You can also threat is a special way HTML text (for example, if it came from TinyMCE) beeing sure that only content characters (not HTML tags) are counted. Example:
TextField('text', default_output_type = 'text/x-html-safe', validators = ('isTidyHtmlWithCleanup', MinCharsValidator(100, strict=True)), ),
Contribute!
You are welcome to add to this product your additional validation (also some unit-tests for every new validator are welcome)! Contact us at sviluppoplone@redturtle.it
You can also contribute providing new translation for validation messages.
Credits
Developed with the support of Azienda USL Ferrara; Azienda USL Ferrara supports the PloneGov initiative.
Changelog
0.1.0 (2011-05-03)
Initial release
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
Built Distribution
Hashes for collective.itvalidators-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4af049b79451ef9894b30f77c74fd7484d3bca975f0f21331a80c2fea650f0e |
|
MD5 | d07ccc780d734909c114396aa246b4e9 |
|
BLAKE2b-256 | 935ef6f8bef4d664dbc1fe7dd20530400e7044b67b67660462aaace240962322 |
Hashes for collective.itvalidators-0.1.0-py2.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | d58b19c7666885c160b027d882966ca9251d65e37b343f639e24ec646c45b729 |
|
MD5 | 4498e105da624aa46ebace2ac889c7f3 |
|
BLAKE2b-256 | 034fc33d2accb18ff1dee2078f80ddea0d4091fb5928c27e1673cb8b54e5bc30 |