~ubuntu-branches/ubuntu/trusty/horizon/trusty

« back to all changes in this revision

Viewing changes to horizon/utils/validators.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-03-09 11:50:22 UTC
  • mfrom: (1.1.9)
  • Revision ID: package-import@ubuntu.com-20120309115022-ymiww5i58rbg97my
Tags: 2012.1~rc1~20120308.1479-0ubuntu1
* New upstream version.
* debian/rules: Fix symlink when installing horizon.
  (LP: #947118)
* debian/control: Add python-django-nose as a dep. (LP: #944235)
* debian/control: Fix broken depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
import re
18
18
 
19
19
from django.core import validators
 
20
from django.core.exceptions import ValidationError
20
21
 
21
22
 
22
23
ipv4_cidr_re = re.compile(r'^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)'   # 0-255
25
26
 
26
27
 
27
28
validate_ipv4_cidr = validators.RegexValidator(ipv4_cidr_re)
 
29
 
 
30
 
 
31
def validate_port_range(port):
 
32
    if port not in range(-1, 65535):
 
33
        raise ValidationError("Not a valid port number")