def realm_list(request, id=None):

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

    return render_to_response(
        'dcmux/realms.xml',
        {
            "realms_uri": uri_lookup(request, "realms"),
            "realms": realms,
        },
        mimetype="application/xml",
    )
List all realms, or the given realm if id!=None.
dataset/ETHPy150Open bmbouter/Opus/opus/project/dcmux/views.py/realm_list