comparison 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
comparison
equal deleted inserted replaced
34:527ccb76d043 35:20e3d138dc98
154 assert min(['=' in link for link in links]) 154 assert min(['=' in link for link in links])
155 links = [ link.split('=', 1) for link in links ] 155 links = [ link.split('=', 1) for link in links ]
156 f['links'] = [ { 'text': text, 'link': link } 156 f['links'] = [ { 'text': text, 'link': link }
157 for text, link in links ] 157 for text, link in links ]
158 158
159
160 class Up(object):
161 """
162 provides an up link to the path above:
163 /up = ..
164 """
165
166 def __init__(self, arg):
167 self.up = arg.strip()
168
169 def __call__(self, request, data):
170 path = request.path_info
171 if (path != '/') and self.up:
172 data['files'].insert(0, {'path': '..',
173 'name': path.rsplit('/', 1)[0] + '/',
174 'description': self.up})
175
159 class CSS(object): 176 class CSS(object):
160 """specify CSS used (whitespace separated list)""" 177 """specify CSS used (whitespace separated list)"""
161 178
162 def __init__(self, arg): 179 def __init__(self, arg):
163 self.css = arg.split() 180 self.css = arg.split()