§
    ‚wg_  ã                   óB   — d dl Z d dlmZ d dlmZ  G d„ de¦  «        ZdS )é    N)Úsettings)ÚFileSystemStoragec                   ó   — e Zd Zd„ ZdS )ÚOverwriteStoragec                 ó¨   — |                       |¦  «        r<t          j        t          j                             t
          j        |¦  «        ¦  «         |S )aÆ  Returns a filename that's free on the target storage system, and
        available for new content to be written to.
        Found at http://djangosnippets.org/snippets/976/
        This file storage solves overwrite on upload problem. Another
        proposed solution was to override the save method on the model
        like so (from https://code.djangoproject.com/ticket/11663):
        def save(self, *args, **kwargs):
            try:
                this = MyModelName.objects.get(id=self.id)
                if this.MyImageFieldName != self.MyImageFieldName:
                    this.MyImageFieldName.delete()
            except: pass
            super(MyModelName, self).save(*args, **kwargs)
        )ÚexistsÚosÚremoveÚpathÚjoinr   Ú
MEDIA_ROOT)ÚselfÚnameÚ
max_lengths      ú6/var/www/html/cms/infrastructure/files/file_storage.pyÚget_available_namez#OverwriteStorage.get_available_name   s@   € ð  ;Š;tÑÔð 	?ÝŒI•b”g—l’l¥8Ô#6¸Ñ=Ô=Ñ>Ô>Ð>Øˆó    N)Ú__name__Ú
__module__Ú__qualname__r   © r   r   r   r      s#   € € € € € ðð ð ð ð r   r   )r	   Údjango.confr   Údjango.core.files.storager   r   r   r   r   ú<module>r      sg   ðØ 	€	€	€	à  Ð  Ð  Ð  Ð  Ð  Ø 7Ð 7Ð 7Ð 7Ð 7Ð 7ðð ð ð ð Ð(ñ ô ð ð ð r   