Revision aa197ee4 api/flavors.py

b/api/flavors.py
35 35
    #                       unauthorized (401),
36 36
    #                       badRequest (400),
37 37
    #                       overLimit (413)
38
    
38

  
39 39
    all_flavors = Flavor.objects.all()
40 40
    flavors = [flavor_to_dict(flavor, detail) for flavor in all_flavors]
41
    
41

  
42 42
    if request.serialization == 'xml':
43 43
        data = render_to_string('list_flavors.xml', {'flavors': flavors, 'detail': detail})
44 44
    else:
45 45
        data = json.dumps({'flavors': {'values': flavors}})
46
    
46

  
47 47
    return HttpResponse(data, status=200)
48 48

  
49 49
@api_method('GET')
......
55 55
    #                       badRequest (400),
56 56
    #                       itemNotFound (404),
57 57
    #                       overLimit (413)
58
    
58

  
59 59
    flavor = get_flavor(flavor_id)
60 60
    flavordict = flavor_to_dict(flavor, detail=True)
61
    
61

  
62 62
    if request.serialization == 'xml':
63 63
        data = render_to_string('flavor.xml', {'flavor': flavordict})
64 64
    else:
65 65
        data = json.dumps({'flavor': flavordict})
66
    
66

  
67 67
    return HttpResponse(data, status=200)

Also available in: Unified diff