'Update the store when a file is updated'

def update_from_file(self, obj, **kwargs):

    if kwargs.get('create'):
        self.create(obj, **kwargs)
    if (not self.exists(obj, **kwargs)):
        raise ObjectNotFound('objectstore.update_from_file,    object    does    not    exist:    {obj},    kwargs:    {kwargs}'.format(obj, kwargs))
    path = self._construct_path(obj, **kwargs)
    cache_path = self._get_cache_path(path)
    file_name = kwargs.get('file_name')
    if file_name:
        source_path = os.path.abspath(file_name)
        try:
            if (source_path != cache_path):
                shutil.copy2(source_path, cache_path)
            self._fix_permissions(cache_path)
        except OSError:
            log.exception('Trouble    copying    source    file    "{source}"    to    cache    "{cache}"'.format(source=source_path, cache=cache_path))
    else:
        with open(cache_path) as f:
            self.pithos.upload_object(obj, f)
