Item copy

This implements an item copy rest call via /item/{} POST.  It adds test coverage for the new functions.  As part of this, I've added a method to the files model to copy a file.  For all of our current three asset stores, I've added code to allow multiple files to use the same data through the use of a repeated reference.
I'll del file['_id'], as I'm taking advantage of the copying other data,
and some of the other data is assetstore-specific.

On Mon, Sep 22, 2014 at 2:15 PM, Zach Mullen <notifications@github.com>
wrote:

> In girder/models/file.py:
>
> > @@ -191,3 +194,32 @@ def createFile(self, creator, item, name, size, assetstore, mimeType):
> >          self.propagateSizeChange(item, size)
> >
> >          return self.save(file)
> > +
> > +    def copyFile(self, srcFile, creator, item=None):
> > +        """
> > +        Copy a file so that we don't need to duplicate stored data.
> > +        :param srcFile: The file to copy.
> > +        :type srcFile: dict
> > +        :param creator: The user copying the file.
> > +        :param item: a new item to assign this file to (optional)
> > +        :return: a dict with the new file.
> > +        """
> > +        # Copy the source file's dictionary.  The individual assetstore
> > +        # implementations will need to fix references if they cannot be
> > +        # directly duplicated.
> > +        file = srcFile.copy()
>
> Won't this also copy the _id field from srcFile, making it override it
> when we save? Let's either del file['_id'] or manually copy over just the
> fields we want.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/girder/girder/pull/337/files#r17866988>.
>