##// END OF EJS Templates
Speed up post hiding, do not load the hidden posts list for each post being processed
Speed up post hiding, do not load the hidden posts list for each post being processed

File last commit:

r1951:1024ce38 default
r2082:47f758c2 default
Show More
sticker_factory.py
33 lines | 946 B | text/x-python | PythonLexer
neko259
Localized a minor sticker message. Refactored sticker factory
r1942 from boards.abstracts.settingsmanager import SessionSettingsManager
from boards.models import Attachment
class StickerFactory:
def get_image(self, alias):
pass
class SessionStickerFactory(StickerFactory):
def __init__(self, session):
self.session = session
def get_image(self, alias):
settings_manager = SessionSettingsManager(self.session)
return settings_manager.get_attachment_by_alias(alias)
class ModelStickerFactory(StickerFactory):
def get_image(self, alias):
neko259
Added sticker pack functionality
r1951 if alias.count('/') == 1:
return Attachment.objects.get_by_alias(alias)
neko259
Localized a minor sticker message. Refactored sticker factory
r1942
def get_attachment_by_alias(alias, session):
"""Gets attachment from a source (local or server/global) using an alias."""
factories = [SessionStickerFactory(session), ModelStickerFactory()]
for factory in factories:
image = factory.get_image(alias)
if image is not None:
return image