Package gluon :: Module validators :: Class IS_STRONG
[hide private]
[frames] | no frames]

Class IS_STRONG

source code

object --+
         |
        IS_STRONG

example:

   INPUT(_type='password', _name='passwd',
       requires=IS_STRONG(min=10, special=2, upper=2))

enforces complexity requirements on a field

>>> IS_STRONG(es=True)('Abcd1234')
('Abcd1234',
 'Must include at least 1 of the following: ~!@#$%^&*()_+-=?<>,.:;{}[]|')
>>> IS_STRONG(es=True)('Abcd1234!')
('Abcd1234!', None)
>>> IS_STRONG(es=True, entropy=1)('a')
('a', None)
>>> IS_STRONG(es=True, entropy=1, min=2)('a')
('a', 'Minimum length is 2')
>>> IS_STRONG(es=True, entropy=100)('abc123')
('abc123', 'Entropy (32.35) less than required (100)')
>>> IS_STRONG(es=True, entropy=100)('and')
('and', 'Entropy (14.57) less than required (100)')
>>> IS_STRONG(es=True, entropy=100)('aaa')
('aaa', 'Entropy (14.42) less than required (100)')
>>> IS_STRONG(es=True, entropy=100)('a1d')
('a1d', 'Entropy (15.97) less than required (100)')
>>> IS_STRONG(es=True, entropy=100)('añd')
('a\xc3\xb1d', 'Entropy (18.13) less than required (100)')
Instance Methods [hide private]
 
__init__(self, min=None, max=None, upper=None, lower=None, number=None, entropy=None, special=None, specials='~!@#$%^&*()_+-=?<>,.:;{}[]|', invalid=' "', error_message=None, es=False)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__call__(self, value) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, min=None, max=None, upper=None, lower=None, number=None, entropy=None, special=None, specials='~!@#$%^&*()_+-=?<>,.:;{}[]|', invalid=' "', error_message=None, es=False)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)