Files
kasu/src/utils/__init__.py
xeniac 3efc4335bb Fixed: ugettext has been deprecated
Fixed: Multiple Upload for Eventpics
2023-06-11 10:10:29 +02:00

35 lines
865 B
Python

"""
Created on 28.09.2011
@author: christian
"""
from django.core.files.storage import FileSystemStorage
from django.utils.translation import gettext as _
from .countries import COUNTRIES
from .html_cleaner import HtmlCleaner
from .massmailer import MassMailer
CLEANER = HtmlCleaner()
STATUS_REJECTED, STATUS_WAITING, STATUS_PUBLISHED = -1, 0, 1
STATUS_CHOICES = (
(STATUS_REJECTED, _('Rejected')),
(STATUS_WAITING, _('Waiting...')),
(STATUS_PUBLISHED, _('Published')),
)
class OverwriteStorage(FileSystemStorage):
"""
Returns same name for existing file and deletes existing file on save.
"""
def _save(self, name, content):
if self.exists(name):
self.delete(name)
return super(OverwriteStorage, self)._save(name, content)
def get_available_name(self, name, max_length=None):
return name