# HG changeset patch # User Jeff Hammel # Date 1290097500 28800 # Node ID 0cc1af24602b280019f01fcc5f2b6314a2f7f76e # Parent 47acf12d01e18668c2923ef952647596ede3aab4 dont show size for directories diff -r 47acf12d01e1 -r 0cc1af24602b decoupage/web.py --- a/decoupage/web.py Thu Nov 18 08:19:06 2010 -0800 +++ b/decoupage/web.py Thu Nov 18 08:25:00 2010 -0800 @@ -212,6 +212,8 @@ def filedata(self, path, directory, conf=None): conf = conf or {} files = [] + + # get data for files filenames = os.listdir(directory) for i in filenames: filepath = os.path.join(directory, i) @@ -220,11 +222,13 @@ filetype = 'directory' modified = os.path.getmtime(filepath) modified = datetime.fromtimestamp(modified) - files.append({'path' : '%s/%s' % (path.rstrip('/'), i), - 'name': i, - 'size': os.path.getsize(filepath), - 'modified': modified, - 'type': filetype}) + data = {'path' : '%s/%s' % (path.rstrip('/'), i), + 'name': i, + 'modified': modified, + 'type': filetype} + if filetype == 'file': + data['size'] = os.path.getsize(filepath) + files.append(data) # TODO: deal with other links in conf for i in conf: