From e06e06da870cd1a374e239fb227fab9f63864d1d Mon Sep 17 00:00:00 2001
From: Justin Caratzas <justin.caratzas@coxinc.com>
Date: Wed, 7 Nov 2012 12:45:42 -0500
Subject: [PATCH] [Issue-508] Indicate via help text the currently configured
and supported extensions on the submission screen
---
mediagoblin/media_types/__init__.py | 4 ++++
mediagoblin/submit/forms.py | 4 +++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/mediagoblin/media_types/__init__.py b/mediagoblin/media_types/__init__.py
index 5bf0124..c258e12 100644
a
|
b
|
def get_media_type_and_manager(filename):
|
118 | 118 | |
119 | 119 | raise FileTypeNotSupported( |
120 | 120 | _(u'Sorry, I don\'t support that file type :(')) |
| 121 | |
| 122 | def get_supported_extensions(): |
| 123 | sublist = [manager['accepted_extensions'] for _, manager in get_media_managers()] |
| 124 | return [item for sub in sublist for item in sub] |
diff --git a/mediagoblin/submit/forms.py b/mediagoblin/submit/forms.py
index bd1e904..f5659fd 100644
a
|
b
|
import wtforms
|
20 | 20 | from mediagoblin.tools.text import tag_length_validator |
21 | 21 | from mediagoblin.tools.translate import fake_ugettext_passthrough as _ |
22 | 22 | from mediagoblin.tools.licenses import licenses_as_choices |
| 23 | from mediagoblin.media_types import get_supported_extensions |
23 | 24 | |
24 | 25 | |
25 | 26 | class SubmitStartForm(wtforms.Form): |
26 | | file = wtforms.FileField(_('File')) |
| 27 | file = wtforms.FileField(_('File'), |
| 28 | description=_('Supported Extensions: %s' % (', '.join([ext for ext in get_supported_extensions()])))) |
27 | 29 | title = wtforms.TextField( |
28 | 30 | _('Title'), |
29 | 31 | [wtforms.validators.Length(min=0, max=500)]) |