Exemple #1
0
 def get_available_name(self, name, max_length=_AZURE_NAME_MAX_LEN):
     """
     Returns a filename that's free on the target storage system, and
     available for new content to be written to.
     """
     name = clean_name(name)
     if self.overwrite_files:
         return get_available_overwrite_name(name, max_length)
     return super(AzureStorage, self).get_available_name(name, max_length)
Exemple #2
0
    def get_available_name(self, name, max_length=None):
        """
        Overrides Django's storage to always return the passed name (overwrite).

        By default, Django will not overwrite files even if the same name is specified.
        This changes that functionality so that the default is to use the same name and overwrite
        rather than modify the path to not clobber files.
        """
        return get_available_overwrite_name(name, max_length=max_length)
 def get_available_name(self, name, max_length=_AZURE_NAME_MAX_LEN):
     """
     Returns a filename that's free on the target storage system, and
     available for new content to be written to.
     """
     name = self.get_valid_name(name)
     if self.overwrite_files:
         return get_available_overwrite_name(name, max_length)
     return super(AzureStorage, self).get_available_name(name, max_length)
Exemple #4
0
    def get_available_name(self, name, max_length=None):
        """
        Overrides Django's storage implementation to always return the passed name (overwrite)

        By default, Django will not overwrite files even if the same name is specified.
        This changes that functionality so that the default is to use the same name and overwrite
        rather than modify the path to not clobber files.
        """
        return get_available_overwrite_name(name, max_length=max_length)
 def get_available_name(self, name, max_length=None):
     """Overwrite existing file with the same name."""
     name = self._clean_name(name)
     if self.file_overwrite:
         return get_available_overwrite_name(name, max_length)
     return super().get_available_name(name, max_length)
Exemple #6
0
 def get_available_name(self, name, max_length=None):
     name = clean_name(name)
     if self.file_overwrite:
         return get_available_overwrite_name(name, max_length)
     return super().get_available_name(name, max_length)
Exemple #7
0
 def get_available_name(self, name, max_length=None):
     """ Overwrite existing file with the same name. """
     name = self._clean_name(name)
     if self.file_overwrite:
         return get_available_overwrite_name(name, max_length)
     return super(S3BotoStorage, self).get_available_name(name, max_length)
Exemple #8
0
 def get_available_name(self, name, max_length=None):
     name = clean_name(name)
     if self.file_overwrite:
         return get_available_overwrite_name(name, max_length)
     return super(GoogleCloudStorage,
                  self).get_available_name(name, max_length)
Exemple #9
0
 def get_available_name(self, name, max_length=None):
     """Overwrite existing file with the same name."""
     name = self._full_path(name)
     if self.write_mode == 'overwrite':
         return get_available_overwrite_name(name, max_length)
     return super().get_available_name(name, max_length)
Exemple #10
0
 def get_available_name(self, name, max_length=None):
     name = get_available_overwrite_name(clean_name(name), max_length)
     if self.exists(name) and not self.file_overwrite:
         raise ValueError("File with the same name already exists")
     return super().get_available_name(name, max_length)