# HG changeset patch # User neko259 # Date 2016-12-12 14:31:09 # Node ID 37185daba4971292d47e7130c588ca7648d46533 # Parent 66fe2364a31b8761e3b0ffa0957f09b9029e5342 Move attachment domains list to a separate module diff --git a/boards/models/attachment/domains.py b/boards/models/attachment/domains.py new file mode 100644 --- /dev/null +++ b/boards/models/attachment/domains.py @@ -0,0 +1,6 @@ +URL_DOMAINS = { + 'meduza.io': 'meduza', + 'youtube.com': 'youtube', + 'youtu.be': 'youtube', + 'wikipedia.org': 'wikipedia', +} diff --git a/boards/models/attachment/viewers.py b/boards/models/attachment/viewers.py --- a/boards/models/attachment/viewers.py +++ b/boards/models/attachment/viewers.py @@ -1,10 +1,11 @@ -import os import re +from django.contrib.staticfiles import finders +from django.contrib.staticfiles.templatetags.staticfiles import static from django.core.files.images import get_image_dimensions from django.template.defaultfilters import filesizeformat -from django.contrib.staticfiles.templatetags.staticfiles import static -from django.contrib.staticfiles import finders + +from boards.models.attachment.domains import URL_DOMAINS REGEX_DOMAIN = re.compile(r'(\w+\.)*(\w+\.\w+)') @@ -46,13 +47,6 @@ URL_PROTOCOLS = { 'magnet': 'magnet', } -URL_DOMAINS = { - 'meduza.io': 'meduza', - 'youtube.com': 'youtube', - 'youtu.be': 'youtube', - 'wikipedia.org': 'wikipedia', -} - CSS_CLASS_IMAGE = 'image' CSS_CLASS_THUMB = 'thumb'