changeset 398:462fc3359ee3

browser_side: radiocol accepts mime type audio/mp3 in addition to audio/mpeg
author souliane <souliane@mailoo.org>
date Tue, 11 Mar 2014 12:31:29 +0100
parents 6148e9063069
children 6e38d317bc16
files browser_side/file_tools.py browser_side/radiocol.py
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/browser_side/file_tools.py	Tue Mar 11 11:53:03 2014 +0100
+++ b/browser_side/file_tools.py	Tue Mar 11 12:31:29 2014 +0100
@@ -58,7 +58,10 @@
             return False
         (size, filetype) = self.getFileInfo()
         if self.types and filetype not in [x for (x, y, z) in self.types]:
-            types = ["- %s (%s)" % (z, y) for (x, y, z) in self.types]
+            types = []
+            for type_ in ["- %s (%s)" % (z, y) for (x, y, z) in self.types]:
+                if type_ not in types:
+                    types.append(type_)
             Window.alert('This file type is not accepted.\nAccepted file types are:\n\n%s' % "\n".join(types))
             return False
         if size > self.max_size * pow(2, 20):
--- a/browser_side/radiocol.py	Tue Mar 11 11:53:03 2014 +0100
+++ b/browser_side/radiocol.py	Tue Mar 11 12:31:29 2014 +0100
@@ -88,7 +88,9 @@
         types = [('audio/ogg', '*.ogg', 'Ogg Vorbis Audio'),
                  ('video/ogg', '*.ogv', 'Ogg Vorbis Video'),
                  ('application/ogg', '*.ogx', 'Ogg Vorbis Multiplex'),
-                 ('audio/mpeg', '*.mp3', 'MPEG-Layer 3')]
+                 ('audio/mpeg', '*.mp3', 'MPEG-Layer 3'),
+                 ('audio/mp3', '*.mp3', 'MPEG-Layer 3'),
+                 ]
         self.file_upload = FilterFileUpload("song", 10, types)
         vPanel.add(self.file_upload)