changeset 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 42f6c76950a4
children 9b9d9cb9734a
files roundup/cgi/engine_zopetal.py roundup/cgi/templating.py
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/cgi/engine_zopetal.py	Fri Jan 11 01:16:59 2013 +0300
+++ b/roundup/cgi/engine_zopetal.py	Fri Jan 11 17:15:06 2013 +0300
@@ -22,15 +22,6 @@
         self.dir = dir
 
     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.
-        """
         # default the name to "home"
         if name is None:
             name = 'home'
--- 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/