Skip to content

Commit 119f33b

Browse files
author
Richard Jones
committed
allow use of XML templates again
1 parent 237ea3c commit 119f33b

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Fixed:
6868
- always honor indexme property on Strings (sf patch 1063711)
6969
- make hyperdb value parsing errors readable in mailgw errors
7070
- make anydbm journal export handle removed properties
71+
- allow use of XML templates again
7172

7273

7374
2004-10-15 0.7.8

roundup/cgi/templating.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ def find_template(dir, name, extension):
8383
if os.path.exists(src):
8484
return (src, filename)
8585

86-
# try with a .html extension (new-style)
87-
filename = filename + '.html'
88-
src = os.path.join(dir, filename)
89-
if os.path.exists(src):
90-
return (src, filename)
86+
# try with a .html or .xml extension (new-style)
87+
for extension in '.html', '.xml':
88+
filename = filename + extension
89+
src = os.path.join(dir, filename)
90+
if os.path.exists(src):
91+
return (src, filename)
9192

9293
# no extension == no generic template is possible
9394
if not extension:
@@ -119,14 +120,19 @@ def precompileTemplates(self):
119120
''' Go through a directory and precompile all the templates therein
120121
'''
121122
for filename in os.listdir(self.dir):
122-
# skip files without ".html" extension - .css, .js etc.
123-
if not filename.endswith(".html"):
124-
continue
125123
# skip subdirs
126124
if os.path.isdir(filename):
127125
continue
126+
# skip files without ".html" or ".xml" extension - .css, .js etc.
127+
for extension in '.html', '.xml':
128+
if filename.endswith(extension):
129+
break
130+
else:
131+
continue
132+
128133
# remove "html" extension
129-
filename = filename[:-len(".html")]
134+
filename = filename[:-len(extension)]
135+
130136
# load the template
131137
if '.' in filename:
132138
name, extension = filename.split('.', 1)

0 commit comments

Comments
 (0)