Revision a96e84cf snf-django-lib/snf_django/lib/api/utils.py

b/snf-django-lib/snf_django/lib/api/utils.py
133 133
        return modified_objs
134 134
    else:
135 135
        return objects.filter(deleted=False)
136

  
137

  
138
def get_attribute(request, attribute, required=True):
139
    value = request.get(attribute, None)
140
    if required and value is None:
141
        raise faults.BadRequest("Malformed request. Missing attribute '%s'." %
142
                                attribute)
143
    return value

Also available in: Unified diff