Exemple #1
0
    def unlink(self):
        """Mark the node as Dead."""
        # we don't modify the 'path' when unlinking the file, to preserve
        # its location when unlinked
        if self.is_dir and self.live_children.exists():
            raise NotEmpty("Can't unlink a non empty directory.")

        if self.parent == ROOT_PARENT:
            raise NoPermission("Can't unlink special files.")

        pre_kill.send(sender=self.__class__, instance=self)
        self.status = STATUS_DEAD
        self.update_generation(save=False)
        self.save(update_fields=['status', 'generation'])

        if self.is_file:
            content_changed.send(sender=self.__class__,
                                 instance=self,
                                 content_added=False,
                                 new_size=0 -
                                 getattr(self.content_blob, 'size', 0),
                                 enforce_quota=False)
        if self.parent != ROOT_PARENT:
            self.parent.when_last_modified = now()
            self.parent.save(update_fields=['when_last_modified'])
        post_kill.send(sender=self.__class__, instance=self)
 def kill(self):
     """Mark this UDF as Dead."""
     pre_kill.send(sender=self.__class__, instance=self)
     size_to_remove = self.volume_size()
     content_changed.send(
         sender=self.__class__, instance=self, content_added=False,
         new_size=0 - size_to_remove, enforce_quota=False)
     self.increment_generation(save=False)
     self.status = STATUS_DEAD
     self.save(update_fields=['generation', 'status'])
     post_kill.send(sender=self.__class__, instance=self)
Exemple #3
0
 def kill(self):
     """Mark this UDF as Dead."""
     pre_kill.send(sender=self.__class__, instance=self)
     size_to_remove = self.volume_size()
     content_changed.send(sender=self.__class__,
                          instance=self,
                          content_added=False,
                          new_size=0 - size_to_remove,
                          enforce_quota=False)
     self.increment_generation(save=False)
     self.status = STATUS_DEAD
     self.save(update_fields=['generation', 'status'])
     post_kill.send(sender=self.__class__, instance=self)
    def unlink(self):
        """Mark the node as Dead."""
        # we don't modify the 'path' when unlinking the file, to preserve
        # its location when unlinked
        if self.is_dir and self.live_children.exists():
                raise NotEmpty("Can't unlink a non empty directory.")

        if self.parent == ROOT_PARENT:
            raise NoPermission("Can't unlink special files.")

        pre_kill.send(sender=self.__class__, instance=self)
        self.status = STATUS_DEAD
        self.update_generation(save=False)
        self.save(update_fields=['status', 'generation'])

        if self.is_file:
            content_changed.send(
                sender=self.__class__, instance=self, content_added=False,
                new_size=0 - getattr(self.content_blob, 'size', 0),
                enforce_quota=False)
        if self.parent != ROOT_PARENT:
            self.parent.when_last_modified = now()
            self.parent.save(update_fields=['when_last_modified'])
        post_kill.send(sender=self.__class__, instance=self)
Exemple #5
0
 def kill(self):
     """Marks itself as dead."""
     pre_kill.send(sender=self.__class__, instance=self)
     self.status = STATUS_DEAD
     self.save(update_fields=['status'])
     post_kill.send(sender=self.__class__, instance=self)
 def kill(self):
     """Marks itself as dead."""
     pre_kill.send(sender=self.__class__, instance=self)
     self.status = STATUS_DEAD
     self.save(update_fields=['status'])
     post_kill.send(sender=self.__class__, instance=self)