changeset 51:8002dcdb8e82

add "-" to list of FilenameDescription separators
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 03 Nov 2010 18:41:42 -0700
parents d327dc7de14f
children a2f09d749a3f 9c15bde43ae6
files decoupage/formatters.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/decoupage/formatters.py
+++ b/decoupage/formatters.py
@@ -123,25 +123,29 @@ class Order(object):
 class FilenameDescription(FormatterBase):
     """
     obtain the description from the filename
     the file extension (if any) will be dropped and
     spaces will be substituted for underscores
     """
     # TODO : deal with CamelCaseFilenames
 
+    separators = ['_', '-'] # space substitute separators
+
     def __call__(self, request, data):
         for f in data['files']:
             if f['description'] is None:
                 description = f['name']
                 if '.' in description:
                     description = description.rsplit('.', 1)[0]
                 decription = description.strip('_')
-                if '_' in description:
-                    description = ' '.join([i.title() for i in description.split('_')])
+                for separator in self.separators:
+                    if separator in description:
+                        description = ' '.join([i.title() for i in description.split(separator)])
+                        
                 f['description'] = description
 
 
 class TitleDescription(FormatterBase):
     """
     splits a description into a title and a description via a separator in 
     the description.  The template will now have an additional variable, 
     'title', per file