diff roundup/cgi/engine_chameleon.py @ 4749:0421390b3094

templating: Move common TAL methods to TALLoaderBase class
author anatoly techtonik <techtonik@gmail.com>
date Tue, 22 Jan 2013 17:29:06 +0300
parents fe9568a6cbd6
children 56c9bcdea47f
line wrap: on
line diff
--- a/roundup/cgi/engine_chameleon.py	Mon Jan 21 23:51:39 2013 +0300
+++ b/roundup/cgi/engine_chameleon.py	Tue Jan 22 17:29:06 2013 +0300
@@ -5,22 +5,15 @@
 import os.path
 import chameleon
 
-from roundup.cgi.templating import StringIO, context, LoaderBase
+from roundup.cgi.templating import StringIO, context, TALLoaderBase
 
-class Loader(LoaderBase):
+class Loader(TALLoaderBase):
     def __init__(self, dir):
         self.dir = dir
         self.loader = chameleon.PageTemplateLoader(dir)
 
-    def check(self, name):
-        for extension in ['', '.html', '.xml']:
-            f = name + extension
-            src = os.path.join(self.dir, f)
-            if os.path.exists(src):
-                return (src, f)
-
     def load(self, tplname):
-        src, filename = self.check(tplname)
+        src, filename = self._find(tplname)
         return RoundupPageTemplate(self.loader.load(src))
 
 class RoundupPageTemplate(object):

Roundup Issue Tracker: http://roundup-tracker.org/