[openstack-dev] [Horizon] Edit subnet in workflows - ip_version hidden?

Akihiro Motoki motoki at da.jp.nec.com
Mon Mar 17 11:13:46 UTC 2014


Hi Abishek, Radomir,

I just noticed this mail.

It seems better the code discussed will be refactored.
UpdateSubnetInfoAction in projects/networks/subnets/workflow.py
inherits CreateSubnetInfoAction in projects/networks/workflow.py.
IIRC I would like to share most logic between two and tried to
remove ip_version from the parent class (in networks.workflow)
in the child class and the current implemention just worked.
It is no more than it.

After looking at it now, it looks enough just to delete ip_version
from self.fields. The same thing can say 'with_subnet' attribute
in networks.subnets.workflows.CreateSubnetInfoAction

When I implemented this, I was not so familir with Django
and perhaps I must have not know deleting a field from self.fields :-(
Thanks for raising this!

Akihiro

(2014/03/12 15:43), Radomir Dopieralski wrote:
> On 11/03/14 16:57, Abishek Subramanian (absubram) wrote:
>
>> Althouh - how up to date is this code?
>
> This should be easy to check with the "git blame" command:
>
> $ git blame
> openstack_dashboard/dashboards/project/networks/subnets/workflows.py
>
> [...]
> 31d55e50 (Akihiro MOTOKI      2013-01-04 18:33:03 +0900  56) class
> CreateSubnet(network_workflows.CreateNetwork):
> [...]
> 31d55e50 (Akihiro MOTOKI      2013-01-04 18:33:03 +0900  82) class
> UpdateSubnetInfoAction(CreateSubnetInfoAction):
> [...]
> 31d55e50 (Akihiro MOTOKI      2013-01-04 18:33:03 +0900 101)
>                          #widget=forms.Select(
> [...]
>
> As you can see, it's all in the same patch, so it's on purpose.
>
> It seems to me, that in the update dialog you are not supposed to change
> the IP Version field, Akihiro Motoki tried to disable it
> first, but then he hit the problem with the browser not submitting
> the field's value and the form displaying the wrong option in there,
> so he decided to hide it instead. But we won't know until the author
> speaks for himself.
>
> Personally, I would also add a check in the clean() method that the
> IP Version field value indeed didn't change -- to make sure nobody
> edited the form's HTML to get rid of the disabled or readonly attribute.
>


More information about the OpenStack-dev mailing list