Edit a pool.

def edit_pool(self, id):
        """ Edit a pool.
        """

        # extract attributes
        p = Pool.get(int(id))
        if 'name' in request.json:
            p.name = validate_string(request.json, 'name')
        if 'description' in request.json:
            p.description = validate_string(request.json, 'description')
        if 'default_type' in request.json:
            p.default_type = validate_string(request.json, 'default_type')
        # TODO: handle integers
        if 'ipv4_default_prefix_length' in request.json:
            p.ipv4_default_prefix_length = request.json['ipv4_default_prefix_length']
        if 'ipv6_default_prefix_length' in request.json:
            p.ipv6_default_prefix_length = request.json['ipv6_default_prefix_length']
        if 'tags' in request.json:
            p.tags = request.json['tags']
        if 'avps' in request.json:
            p.avps = request.json['avps']

        try:
           p.save()
        except NipapError, e:
            return json.dumps({'error': 1, 'message': e.args, 'type': type(e).__name__})

        return json.dumps(p, cls=NipapJSONEncoder)