# HG changeset patch # User k0s <k0scist@gmail.com> # Date 1265674890 18000 # Node ID 20e3d138dc988e4420e9e34ecdf3092057c36c8f # Parent 527ccb76d0431240661f36b200aad81b7ef5a461 better way of doing up; this breaks old behaviour so incrementing version diff -r 527ccb76d043 -r 20e3d138dc98 decoupage/formatters.py --- 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)""" diff -r 527ccb76d043 -r 20e3d138dc98 decoupage/templates/index.html --- a/decoupage/templates/index.html Mon Feb 08 11:44:20 2010 -0500 +++ b/decoupage/templates/index.html Mon Feb 08 19:21:30 2010 -0500 @@ -15,7 +15,6 @@ <xi:include py:if="include" href="${include}"/> <h1 py:if="title">${title}</h1> <ul id="listing"> - <li py:if="request.path_info.strip('/')"><a href="..">..</a></li> <li py:for="f in files"> <a href="${f['path']}"> ${f.get('title', f['description']) or f['name']}</a><span py:if="'title' in f and f['description']">: ${f['description']} diff -r 527ccb76d043 -r 20e3d138dc98 decoupage/web.py --- a/decoupage/web.py Mon Feb 08 11:44:20 2010 -0500 +++ b/decoupage/web.py Mon Feb 08 19:21:30 2010 -0500 @@ -169,10 +169,19 @@ def filedata(self, path, directory, conf): files = [] + + # TODO: other items to add + # type: 'file' or 'directory' + # last_modified + # created + for i in os.listdir(directory): files.append({'path' : '%s/%s' % (path.rstrip('/'), i), 'name': i, 'description': conf.get(i.lower(), None)}) + + # TODO: deal with other links in conf + return files def conf(self, path, cascade=None): diff -r 527ccb76d043 -r 20e3d138dc98 example.ini --- a/example.ini Mon Feb 08 11:44:20 2010 -0500 +++ b/example.ini Mon Feb 08 19:21:30 2010 -0500 @@ -1,7 +1,9 @@ [/] /ignore = .* +/up = .. foo.txt = a file about cats [/cats] +/up = .. lilly.txt = lilly hobbes.txt = a file about Hobbes \ No newline at end of file diff -r 527ccb76d043 -r 20e3d138dc98 setup.py --- a/setup.py Mon Feb 08 11:44:20 2010 -0500 +++ b/setup.py Mon Feb 08 19:21:30 2010 -0500 @@ -6,7 +6,7 @@ except IOError: description = '' -version = '0.6' +version = '0.7' setup(name='decoupage', version=version, @@ -49,6 +49,7 @@ scripts = decoupage.formatter:JavaScript sort = decoupage.formatters:Sort title = decoupage.formatters:TitleDescription + up = decoupage.formatters:Up """, )