All pastes #107894 Raw Edit

Anonymous

public python v1 · immutable
#107894 ·published 2006-07-31 04:27 UTC
rendered paste body
FILES_ROOT = '/home/'def files(request,dir):    # this has got to go!    #	parent_dir = '/'	tmp = os.path.split(dir[:-1])[0]	if not tmp == dir[:-1]:		parent_dir += tmp    #    #    full_path = FILES_ROOT + dir	# dir	if os.path.isdir(full_path):        files_and_dirs = list(get_file_stats(file) for file in os.listdir(full_path))		return render_to_response('list.html',{            # full_path is a dir, so we don't need any funny [:-1]			'dir':full_path,			'dir_list':files_and_dirs,			'parent_dir':parent_dir,		}, context_instance=RequestContext(request))....def get_file_stats(file):    (mode, inode, dev, num_links, uid, gid, size, atime, mtime, ctime) = os.stat(file)    return {'mode': mode, 'uid': uid, 'gid': gid, 'size': size, 'atime':atime, 'mtime':mtime, 'ctime':ctime, 'is_dir':S_ISDIR(mode)}