def getObjects(request, conn=None):
    """
    Prepare objects for use in the annotation forms.
    These objects are required by the form superclass to populate hidden
    fields, so we know what we're annotating on submission
    """
    r = request.GET or request.POST
    images = len(r.getlist('image')) > 0 and list(conn.getObjects('Image',
        r.getlist('image'))) or list()
    datasets = len(r.getlist('dataset')) > 0 and list(conn.getObjects(
        'Dataset', r.getlist('dataset'))) or list()
    projects = len(r.getlist('project')) > 0 and list(conn.getObjects(
        'Project', r.getlist('project'))) or list()
    screens = len(r.getlist('screen')) > 0 and list(conn.getObjects(
        'Screen', r.getlist('screen'))) or list()
    plates = len(r.getlist('plate')) > 0 and list(conn.getObjects('Plate',
        r.getlist('plate'))) or list()
    acquisitions = len(r.getlist('acquisition')) > 0 and list(conn.
        getObjects('PlateAcquisition', r.getlist('acquisition'))) or list()
    shares = len(r.getlist('share')) > 0 and [conn.getShare(r.getlist(
        'share')[0])] or list()
    wells = len(r.getlist('well')) > 0 and list(conn.getObjects('Well', r.
        getlist('well'))) or list()
    return {'image': images, 'dataset': datasets, 'project': projects,
        'screen': screens, 'plate': plates, 'acquisition': acquisitions,
        'well': wells, 'share': shares}
