Mercurial > hg > decoupage
diff decoupage/web.py @ 12:9f91acf9874c
* split on space in formatters to be consist with everything else
* break filedata into its own function
author | k0s <k0scist@gmail.com> |
---|---|
date | Fri, 25 Dec 2009 02:59:47 -0500 |
parents | a328cc9d2c74 |
children | ab0c2bb4d23d |
line wrap: on
line diff
--- a/decoupage/web.py Fri Dec 25 01:11:38 2009 -0500 +++ b/decoupage/web.py Fri Dec 25 02:59:47 2009 -0500 @@ -95,13 +95,8 @@ # get the configuraton conf = self.conf(path) - # add data for the files - files = [] - for i in os.listdir(directory): - files.append({'path' : '%s/%s' % (path.rstrip('/'), i), - 'name': i, - 'description': conf.get(i.lower(), None)}) # build data dictionary + files = self.filedata(path, directory, conf) data = {'path': path, 'files': files, 'request': request} # apply formatters @@ -121,7 +116,6 @@ formatter = self.formatters[name](conf.get('/%s' % name, '')) formatter(request, data) - # render the template template = conf.get('/template') if template is None: @@ -139,6 +133,14 @@ ### internal methods + def filedata(self, path, directory, conf): + files = [] + for i in os.listdir(directory): + files.append({'path' : '%s/%s' % (path.rstrip('/'), i), + 'name': i, + 'description': conf.get(i.lower(), None)}) + return files + def conf(self, path, cascade=None): """returns configuration dictionary appropriate to a path""" if cascade is None: