Checked items now work

This address issue #118.  The download and delete actions work as expected.  Internally, there are two new endpoints: resource/download GET and resource DELETE.  The download can actually get item, folder, user, and collection resources, and the delete can work on any model that has a remove method.
For deletes, that is fine.  For downloads, however, if we don't check ahead
of time, then we will have already output some of the zip file before we
realize there is a problem, and then we can't issue the error.  Without
validation in the download, we would just output what we could, and skip
any invalid resource or id.

Thoughts?

On Tue, Oct 14, 2014 at 9:06 PM, Zach Mullen <notifications@github.com>
wrote:

> In girder/api/v1/resource.py:
>
> > +            except Exception as exc:
> > +                if exc.message.startswith('Could not load model '):
> > +                    model = None
> > +                else:
> > +                    raise
> > +            if not model or not hasattr(model, funcName):
> > +                raise RestException('Invalid resources format.')
> > +            for id in resources[kind]:
> > +                if model.load(id=id, **access):
> > +                    count += 1
> > +                else:
> > +                    raise RestException('Resource %s %s not found.' % (kind,
> > +                                                                       id))
> > +        if not count:
> > +            raise RestException('No resources specified.')
> > +        return resources
>
> The way we use this function, we end up loading all of the models twice,
> but since this doesn't truly guarantee that the task will be valid through
> its full duration, I think we should save the time and code and just get
> rid of this. If the client passes an invalid model name or an invalid model
> ID, I'm OK with the task deleting some of the selected resources then
> erroring out partway through.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/girder/girder/pull/398/files#r18870161>.
>