Ticket #508: issue_508.patch

File issue_508.patch, 1.8 KB (added by bigjust, 12 years ago)
  • mediagoblin/media_types/__init__.py

    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):  
    118118
    119119    raise FileTypeNotSupported(
    120120        _(u'Sorry, I don\'t support that file type :('))
     121
     122def 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]
  • mediagoblin/submit/forms.py

    diff --git a/mediagoblin/submit/forms.py b/mediagoblin/submit/forms.py
    index bd1e904..f5659fd 100644
    a b import wtforms  
    2020from mediagoblin.tools.text import tag_length_validator
    2121from mediagoblin.tools.translate import fake_ugettext_passthrough as _
    2222from mediagoblin.tools.licenses import licenses_as_choices
     23from mediagoblin.media_types import get_supported_extensions
    2324
    2425
    2526class 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()]))))
    2729    title = wtforms.TextField(
    2830        _('Title'),
    2931        [wtforms.validators.Length(min=0, max=500)])