Mercurial > p > roundup > code
diff roundup/cgi/templating.py @ 2961:68ba01244341
oops
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 25 Nov 2004 22:29:30 +0000 |
| parents | fa5410ae581d |
| children | 4607f58a007b |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Thu Nov 25 22:19:51 2004 +0000 +++ b/roundup/cgi/templating.py Thu Nov 25 22:29:30 2004 +0000 @@ -69,12 +69,12 @@ 'items of class %(class)s') % { 'action': self.action, 'class': self.klass} -def find_template(dir, name, extension): +def find_template(dir, name, view): ''' Find a template in the nominated dir ''' # find the source - if extension: - filename = '%s.%s'%(name, extension) + if view: + filename = '%s.%s'%(name, view) else: filename = name @@ -90,12 +90,12 @@ if os.path.exists(src): return (src, filename) - # no extension == no generic template is possible - if not extension: + # no view == no generic template is possible + if not view: raise NoTemplate, 'Template file "%s" doesn\'t exist'%name # try for a _generic template - generic = '_generic.%s'%extension + generic = '_generic.%s'%view src = os.path.join(dir, generic) if os.path.exists(src): return (src, generic) @@ -107,7 +107,7 @@ return (src, generic) raise NoTemplate, 'No template file exists for templating "%s" '\ - 'with template "%s" (neither "%s" nor "%s")'%(name, extension, + 'with template "%s" (neither "%s" nor "%s")'%(name, view, filename, generic) class Templates: @@ -123,6 +123,7 @@ # skip subdirs if os.path.isdir(filename): continue + # skip files without ".html" or ".xml" extension - .css, .js etc. for extension in '.html', '.xml': if filename.endswith(extension): @@ -130,7 +131,7 @@ else: continue - # remove "html" extension + # remove extension filename = filename[:-len(extension)] # load the template
