Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 def _check_delete_allowed(self):
     if self.is_preprint_primary:
         raise exceptions.FileNodeIsPrimaryFile()
     if self.is_checked_out:
         raise exceptions.FileNodeCheckedOutError()
     return True