def image_list(request, id=None):
    """List all aggregate images, or the given image if id!=None."""

    if id == None:
        images = AggregateImage.objects.all()
    else:
        try:
            images = [AggregateImage.objects.get(id=id)]
        except __HOLE__:
            # id wasn't an int, which it should be
            images = []
        except ObjectDoesNotExist:
            # id not found in database
            images = []

    return render_to_response(
        'dcmux/images.xml',
        {
            "images_uri": uri_lookup(request, "images"),
            "images": images,
        },
        mimetype="application/xml",
    )
dataset/ETHPy150Open bmbouter/Opus/opus/project/dcmux/views.py/image_list