Code

allow get("issue.item") for getting templates
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 18 Feb 2003 01:48:39 +0000 (01:48 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Tue, 18 Feb 2003 01:48:39 +0000 (01:48 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1519 57a73879-2fb5-44c3-a270-3262357dd7e2

roundup/cgi/templating.py

index 54bf622e8d0ae9316c43a20323f79ca81f25f76e..894c5d6abaede19e1b3d8cc8c2baf4aeb6b0352b 100644 (file)
@@ -42,7 +42,7 @@ class Templates:
             else:
                 self.getTemplate(filename, None)
 
-    def get(self, name, extension):
+    def get(self, name, extension=None):
         ''' Interface to get a template, possibly loading a compiled template.
 
             "name" and "extension" indicate the template we're after, which in
@@ -55,12 +55,16 @@ class Templates:
         # default the name to "home"
         if name is None:
             name = 'home'
+        elif extension is None and '.' in name:
+            # split name
+            name, extension = name.split('.')
 
         # find the source, figure the time it was last modified
         if extension:
             filename = '%s.%s'%(name, extension)
         else:
             filename = name
+
         src = os.path.join(self.dir, filename)
         try:
             stime = os.stat(src)[os.path.stat.ST_MTIME]