diff roundup/cgi/templating.py @ 4724:98b727b6f7f8

Self-focument API in templating.py loader class
author anatoly techtonik <techtonik@gmail.com>
date Fri, 11 Jan 2013 17:15:06 +0300
parents ec359e7c6c95
children 5033c2ad80a7
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Fri Jan 11 01:16:59 2013 +0300
+++ b/roundup/cgi/templating.py	Fri Jan 11 17:15:06 2013 +0300
@@ -144,12 +144,25 @@
             else:
                 self.get(filename, None)
 
+    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
+            most cases will be "name.extension". If "extension" is None, then
+            we look for a template just called "name" with no extension.
+
+            If the file "name.extension" doesn't exist, we look for
+            "_generic.extension" as a fallback.
+        """
+        # [ ] document default 'home' template and other special pages
+        raise NotImplementedError
+
     def __getitem__(self, name):
+        """Special method to access templates by loader['name']"""
         name, extension = os.path.splitext(name)
         if extension:
             extension = extension[1:]
         try:
-            # [ ] dispell - add get() definition to this base class
             return self.get(name, extension)
         except NoTemplate, message:
             raise KeyError, message

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