def move_under(self, destination_parent, name=None): if self.is_preprint_primary: if self.node != destination_parent.node or self.provider != destination_parent.provider: raise exceptions.FileNodeIsPrimaryFile() if self.is_checked_out: raise exceptions.FileNodeCheckedOutError() return super(OsfStorageFileNode, self).move_under(destination_parent, name)
def move_under(self, destination_parent, name=None): if self.is_preprint_primary: if self.target != destination_parent.target or self.provider != destination_parent.provider: raise exceptions.FileNodeIsPrimaryFile() if self.is_checked_out: raise exceptions.FileNodeCheckedOutError() self.update_region_from_latest_version(destination_parent) return super(OsfStorageFileNode, self).move_under(destination_parent, name)
def move_under(self, destination_parent, name=None): if self.is_preprint_primary: if self.target != destination_parent.target or self.provider != destination_parent.provider: raise exceptions.FileNodeIsPrimaryFile() if self.is_checked_out: raise exceptions.FileNodeCheckedOutError() most_recent_fileversion = self.versions.select_related( 'region').order_by('-created').first() if most_recent_fileversion and most_recent_fileversion.region != destination_parent.target.osfstorage_region: most_recent_fileversion.region = destination_parent.target.osfstorage_region most_recent_fileversion.save() return super(OsfStorageFileNode, self).move_under(destination_parent, name)
def _check_delete_allowed(self): if self.is_preprint_primary: raise exceptions.FileNodeIsPrimaryFile() if self.is_checked_out: raise exceptions.FileNodeCheckedOutError() return True