diff decoupage/formatters.py @ 35:20e3d138dc98

better way of doing up; this breaks old behaviour so incrementing version
author k0s <k0scist@gmail.com>
date Mon, 08 Feb 2010 19:21:30 -0500
parents 527ccb76d043
children 677e2fe1239c
line wrap: on
line diff
--- a/decoupage/formatters.py	Mon Feb 08 11:44:20 2010 -0500
+++ b/decoupage/formatters.py	Mon Feb 08 19:21:30 2010 -0500
@@ -156,6 +156,23 @@
                 f['links'] = [ { 'text': text, 'link': link }
                              for text, link in links ]
 
+
+class Up(object):
+    """
+    provides an up link to the path above:
+    /up = ..
+    """
+
+    def __init__(self, arg):
+        self.up = arg.strip()
+    
+    def __call__(self, request, data):
+        path = request.path_info
+        if (path != '/') and self.up:
+            data['files'].insert(0, {'path': '..',
+                                     'name': path.rsplit('/', 1)[0] + '/',
+                                     'description': self.up})
+
 class CSS(object):
     """specify CSS used (whitespace separated list)"""