ValidationError not caught in SelfHandlingForm

Bug #958971 reported by Gabriel Hurley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Fix Released
Critical
Gabriel Hurley

Bug Description

The SelfHandlingForm code is calling the clean() method in order to get the form's cleaned data. This is not only redundant (as the call to is_valid above takes care of cleaning the data), it's dangerous, since the standard way to trigger a validation error for a condition which applies to multiple fields in Django is to raise ValidationError in the clean() method, which is *not* caught in the Horizon code.

The correct way to access the data is to use form.cleaned_data after calling form.is_valid().

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to horizon (master)

Fix proposed to branch: master
Review: https://review.openstack.org/5495

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/5495
Committed: http://github.com/openstack/horizon/commit/fccfacb6b5e9d136766a9e0947ec3fa596835cfa
Submitter: Jenkins
Branch: master

commit fccfacb6b5e9d136766a9e0947ec3fa596835cfa
Author: Gabriel Hurley <email address hidden>
Date: Sun Mar 18 20:57:12 2012 -0700

    Security Group Rule enhancements.

      * Corrects inconcsistent capitalization. Fixes bug 956760.
      * Adds a default value for CIDR and updates handling code. Fixes bug 956771.
      * Corrects the way SelfHandlingForm access the cleaned data. Fixes bug 958971.

    Change-Id: I66afeb4b530be350f33f63c8f9a60bd4a20e01bf

Changed in horizon:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in horizon:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in horizon:
milestone: essex-rc1 → 2012.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.