diff roundup/htmltemplate.py @ 627:952679be9e2c

Added simple editing for classes that don't define a templated interface. - access using the admin "class list" interface - limited to admin-only - requires the csv module from object-craft (url given if it's missing)
author Richard Jones <richard@users.sourceforge.net>
date Wed, 20 Feb 2002 05:05:29 +0000
parents 159ed4209819
children 53549c6a7b33
line wrap: on
line diff
--- a/roundup/htmltemplate.py	Wed Feb 20 05:04:32 2002 +0000
+++ b/roundup/htmltemplate.py	Wed Feb 20 05:05:29 2002 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: htmltemplate.py,v 1.76 2002-02-16 09:10:52 richard Exp $
+# $Id: htmltemplate.py,v 1.77 2002-02-20 05:05:29 richard Exp $
 
 __doc__ = """
 Template engine.
@@ -33,6 +33,9 @@
 except ImportError:
     StructuredText = None
 
+class MissingTemplateError(ValueError):
+    pass
+
 class TemplateFunctions:
     def __init__(self):
         self.form = None
@@ -714,8 +717,12 @@
 
         # XXX deviate from spec here ...
         # load the index section template and figure the default columns from it
-        template = open(os.path.join(self.templates,
-            self.classname+'.index')).read()
+        try:
+            template = open(os.path.join(self.templates,
+                self.classname+'.index')).read()
+        except IOError, error:
+            if error.errno not in (errno.ENOENT, errno.ESRCH): raise
+            raise MissingTemplateError, self.classname+'.index'
         all_columns = self.col_re.findall(template)
         if not columns:
             columns = []
@@ -1070,6 +1077,9 @@
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.76  2002/02/16 09:10:52  richard
+# oops
+#
 # Revision 1.75  2002/02/16 08:43:23  richard
 #  . #517906 ] Attribute order in "View customisation"
 #

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