changeset 55:47acf12d01e1

merge commit
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 18 Nov 2010 08:19:06 -0800
parents 0e2b9e0507c5 (diff) a2f09d749a3f (current diff)
children 0cc1af24602b
files decoupage/formats.py
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/decoupage/formats.py	Tue Nov 16 21:14:25 2010 -0800
+++ b/decoupage/formats.py	Thu Nov 18 08:19:06 2010 -0800
@@ -1,8 +1,13 @@
+"""
+pluggable formats for directory listings
+"""
+
 try:
   import json as json
 except ImportError:
   import simplejson as json
 
+# TODO: convert this to a class
 def format_json(data):
 
   # fix datetime
@@ -12,3 +17,7 @@
 
   return 'application/json', json.dumps(data['files'])
   
+class RSS(object):
+
+  def __init__(self, n=10):
+    pass
--- a/decoupage/formatters.py	Tue Nov 16 21:14:25 2010 -0800
+++ b/decoupage/formatters.py	Thu Nov 18 08:19:06 2010 -0800
@@ -129,6 +129,7 @@
     # TODO : deal with CamelCaseFilenames
 
     separators = ['_', '-'] # space substitute separators
+    lesser_words = [ 'or', 'a', 'the', 'on', 'of' ] # unimportant words
 
     def __call__(self, request, data):
         for f in data['files']:
@@ -139,8 +140,9 @@
                 decription = description.strip('_')
                 for separator in self.separators:
                     if separator in description:
-                        description = ' '.join([i.title() for i in description.split(separator)])
-                        
+                        description = ' '.join([(i in self.lesser_words) and i or i.title()
+                                                for i in description.split(separator)])
+                        description = description[0].upper() + description[1:]
                 f['description'] = description