Some of the information here may be outdated, please check the book instead

New IS_IPV4 validator checks if field's value is an IP version 4 address in decimal form.

Can be set to force adresses from certain range.

                                                 error_message='invalid IPv4
  1. minip: lowest allowed address; accepts: str (eg., iterable of numbers (eg. [192, 168, 0, 1]) or int (eg. 3232235521)
  2. maxip: highest allowed address; same as above

All three example values are equal, since addresses are converted to integers for inclusion check with following function:

number = 16777216 * IP[0] + 65536 * IP[1] + 256 * IP[2] + IP[3]


Check for valid IPv4 address:


Check for valid private network IPv4 address:

© 2008-2010 by Massimo Di Pierro - All rights reserved - Powered by web2py - design derived from a theme by the earlybird
The content of this book is released under the Artistic License 2.0 - Modified content cannot be reproduced.