Mercurial > hg > decoupage
comparison decoupage/web.py @ 69:9fac58348520
whitespace cleanup
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 03 Aug 2012 23:48:25 -0700 |
parents | ac1dc088e37e |
children | 262fb90a54b4 |
comparison
equal
deleted
inserted
replaced
68:4094bee13154 | 69:9fac58348520 |
---|---|
196 content_type, body = _format(request, data) | 196 content_type, body = _format(request, data) |
197 return Response(content_type=content_type, body=body) | 197 return Response(content_type=content_type, body=body) |
198 | 198 |
199 # render the template | 199 # render the template |
200 template = conf.get('/template') | 200 template = conf.get('/template') |
201 local_index = False | 201 local_index = False |
202 if template is None: | 202 if template is None: |
203 if 'index.html' in [ f['name'] for f in files ]: | 203 if 'index.html' in [ f['name'] for f in files ]: |
204 local_index = os.path.join(directory, 'index.html') | 204 local_index = os.path.join(directory, 'index.html') |
205 template = local_index | 205 template = local_index |
206 else: | 206 else: |
249 'modified': modified, | 249 'modified': modified, |
250 'type': filetype} | 250 'type': filetype} |
251 if filetype == 'file': | 251 if filetype == 'file': |
252 data['size'] = os.path.getsize(filepath) | 252 data['size'] = os.path.getsize(filepath) |
253 files.append(data) | 253 files.append(data) |
254 | 254 |
255 # TODO: deal with other links in conf | 255 # TODO: deal with other links in conf |
256 for i in conf: | 256 for i in conf: |
257 if i in filenames or i.startswith('/'): | 257 if i in filenames or i.startswith('/'): |
258 continue | 258 continue |
259 if i.startswith('http://') or i.startswith('https://'): | 259 if i.startswith('http://') or i.startswith('https://'): |
260 files.append({'path': i, | 260 files.append({'path': i, |
261 'name': i, | 261 'name': i, |
262 'type': link}) | 262 'type': link}) |
263 | 263 |
264 for f in files: | 264 for f in files: |
265 f['description'] = conf.get(f['name'], None) | 265 f['description'] = conf.get(f['name'], None) |
266 | 266 |
267 return files | 267 return files |
268 | 268 |
302 inherit_directory = '/%s' % '/'.join(path_tuple[:-1]) | 302 inherit_directory = '/%s' % '/'.join(path_tuple[:-1]) |
303 if inherit_directory: | 303 if inherit_directory: |
304 parent_configuration = self.conf(inherit_directory) | 304 parent_configuration = self.conf(inherit_directory) |
305 for key, value in parent_configuration.items(): | 305 for key, value in parent_configuration.items(): |
306 if key.startswith('/') and key not in conf: | 306 if key.startswith('/') and key not in conf: |
307 conf[key] = value | 307 conf[key] = value |
308 | 308 |
309 # cache configuration | 309 # cache configuration |
310 if not self.auto_reload: | 310 if not self.auto_reload: |
311 if not hasattr(self, '_conf'): | 311 if not hasattr(self, '_conf'): |
312 self._conf = {} | 312 self._conf = {} |
318 formatters = [] | 318 formatters = [] |
319 for key, value in self.conf(path).items(): | 319 for key, value in self.conf(path).items(): |
320 if key.startswith('/'): | 320 if key.startswith('/'): |
321 key = key[1:] | 321 key = key[1:] |
322 if key in self.formatters: | 322 if key in self.formatters: |
323 formatter = self.formatters[key](value) | 323 formatter = self.formatters[key](value) |
324 | 324 |