##// END OF EJS Templates
Allow speed ban
Allow speed ban

File last commit:

r1590:0eb7ac3c default
r1899:0d841c55 default
Show More
attachment_alias.py
28 lines | 772 B | text/x-python | PythonLexer
neko259
Added image aliases to upload the same images (like "fake" or "gtfo")
r1500 from boards.abstracts.settingsmanager import SessionSettingsManager
neko259
Store images as regular attachments instead of separate model
r1590 from boards.models import Attachment
neko259
Added image aliases to upload the same images (like "fake" or "gtfo")
r1500
class AttachmentAlias:
def get_image(alias):
pass
class SessionAttachmentAlias(AttachmentAlias):
def __init__(self, session):
self.session = session
def get_image(self, alias):
settings_manager = SessionSettingsManager(self.session)
return settings_manager.get_image_by_alias(alias)
class ModelAttachmentAlias(AttachmentAlias):
def get_image(self, alias):
neko259
Store images as regular attachments instead of separate model
r1590 return Attachment.objects.filter(alias=alias).first()
neko259
Added image aliases to upload the same images (like "fake" or "gtfo")
r1500
def get_image_by_alias(alias, session):
image = SessionAttachmentAlias(session).get_image(alias) or ModelAttachmentAlias().get_image(alias)
if image is not None:
return image