Changeset 2906 for projects/TemplateBrowser
- Timestamp:
- 04/22/07 02:52:25 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
projects/TemplateBrowser/trunk/templatebrowser/toolbox.py
r2512 r2906 6 6 7 7 class TemplateBrowser(controllers.Controller): 8 """Browse Templates. 9 Scans the project directories and 8 """Browse Templates. 9 Scans the project directories and 10 10 collect your templates in single page. 11 11 """ … … 16 16 __copyright__ = "Copyright 2007 Fred Lin" 17 17 __license__ = "MIT" 18 18 19 19 baseTemplate = 'templatebrowser' 20 languages = None20 #languages = None 21 21 icon = "/tg_static/images/widgets.png" 22 22 need_project = True 23 24 23 25 24 def __init__(self,currentProject=None): … … 30 29 def project_files(self): 31 30 """ 32 Walk through the directory, return the template name, path 31 Walk through the directory, return the template name, path 33 32 """ 34 33 p = turbogears.util.get_package_name() … … 41 40 'dir':os.path.dirname(dirpath), 42 41 'file_name':os.path.basename(dirpath), 43 'path':dirpath, 42 'path':dirpath, 44 43 'isdir':True, 45 44 'level':level … … 75 74 76 75 os.path.walk(p, collect_files, fl) 77 return [x for x in turbogears.util.flatten_sequence(fl) 76 return [x for x in turbogears.util.flatten_sequence(fl) 78 77 if not x["isdir"] or visibility[x["path"]]] 79 80 78 81 79 def index(self): 82 80 return dict(project_files=self.project_files()) … … 93 91 f=open(self.currentProject+'/'+file['path'],'r') 94 92 #return dict(content = f.read()) 95 return f.read() 96 93 return f.read() 94 97 95 @turbogears.expose() 98 96 def preview(self, filename): … … 108 106 """ 109 107 return self.render(filename, ContentType = 'text/plain') 110