Review: Needs Fixing


Diff comments:

> diff --git a/src/maasserver/websockets/handlers/vlan.py 
> b/src/maasserver/websockets/handlers/vlan.py
> index c642143..7236d2c 100644
> --- a/src/maasserver/websockets/handlers/vlan.py
> +++ b/src/maasserver/websockets/handlers/vlan.py
> @@ -67,6 +67,9 @@ class VLANHandler(TimestampedModelHandler):
>          data["rack_sids"] = sorted(
>              node.system_id for node in nodes if node.is_rack_controller
>          )
> +        data["subnet_ids"] = sorted(
> +            subnet.id for subnet in obj.subnet_set.all()
> +        )

Instead of doing the sorting and field selection in Python, it's better to do 
it in the DB - like

data["subnet_ids"] = obj.subnet_set.values_list("id", flat=True).order_by("id")

>          if not for_list:
>              data["node_ids"] = sorted(node.id for node in nodes)
>              data["space_ids"] = sorted(


-- 
https://code.launchpad.net/~emdw/maas/+git/maas/+merge/440266
Your team MAAS Committers is subscribed to branch maas:master.


-- 
Mailing list: https://launchpad.net/~sts-sponsors
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~sts-sponsors
More help   : https://help.launchpad.net/ListHelp

Reply via email to