Revision b19653d1 api/util.py

b/api/util.py
116 116
    except Flavor.DoesNotExist:
117 117
        raise ItemNotFound('Flavor not found.')
118 118

  
119
def get_network(network, owner):
119
def get_network(network_id, owner):
120 120
    """Return a Network instance or raise ItemNotFound."""
121 121
    
122 122
    try:
123
        return Network.objects.get(name=network, owner=owner)
123
        return Network.objects.get(id=network_id, owner=owner)
124 124
    except ValueError:
125
        raise BadRequest('Invalid network name.')
125
        raise BadRequest('Invalid network ID.')
126 126
    except Network.DoesNotExist:
127 127
        raise ItemNotFound('Network not found.')
128 128

  

Also available in: Unified diff