diff options
author | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-10-26 22:11:03 +0000 |
---|---|---|
committer | Ken Raffenetti <raffenet@mcs.anl.gov> | 2006-10-26 22:11:03 +0000 |
commit | d954c50097843363136efeec602833894db8321e (patch) | |
tree | f3b360592533bed1adcabfc55081bae499d71111 /src | |
parent | ec0dcd65ccfdf886894cae5816aa3f3221b48eb7 (diff) | |
download | bcfg2-d954c50097843363136efeec602833894db8321e.tar.gz bcfg2-d954c50097843363136efeec602833894db8321e.tar.bz2 bcfg2-d954c50097843363136efeec602833894db8321e.zip |
fixed validation for newly added interfaces and ips from the host edit page
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2459 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Server/Hostbase/hostbase/views.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/lib/Server/Hostbase/hostbase/views.py b/src/lib/Server/Hostbase/hostbase/views.py index 9b342f188..1f8a6787b 100644 --- a/src/lib/Server/Hostbase/hostbase/views.py +++ b/src/lib/Server/Hostbase/hostbase/views.py @@ -1,8 +1,8 @@ -# Create your views here. """Views.py Contains all the views associated with the hostbase app Also has does form validation """ +__revision__ = "$Revision: $" from django.http import HttpResponse, HttpResponseRedirect @@ -53,7 +53,6 @@ dispatch = {'mac_addr':'i.mac_addr LIKE \'%%%%%s%%%%\'', ## t.failures = False ## return HttpResponse(str(t)) - def login(request): return render_to_response('login.html', {'next':'/hostbase'}) @@ -741,6 +740,15 @@ def validate(request, new=False, host_id=None): for number in request.POST['ip_addr%d' % ip.id].split(".") if (number.isdigit() and int(number) > 255 and 'ip_addr (%s)' % request.POST['ip_addr%d' % ip.id] not in failures)] + if (request.POST['%dip_addr' % interface.id] + and not regex.ipaddr.match(request.POST['%dip_addr' % interface.id])): + failures.append('ip_addr (%s)' % request.POST['%dip_addr' % interface.id]) + if (request.POST['mac_addr_new'] + and not regex.macaddr.match(request.POST['mac_addr_new'])): + failures.append('mac_addr (%s)' % request.POST['mac_addr_new']) + if (request.POST['ip_addr_new'] + and not regex.ipaddr.match(request.POST['ip_addr_new'])): + failures.append('ip_addr (%s)' % request.POST['ip_addr_new']) if not failures: return 0 |