[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - editview.py:1.23

Jim Fulton jim@zope.com
Fri, 2 May 2003 14:27:37 -0400


Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv30457/browser/form

Modified Files:
	editview.py 
Log Message:
Added check that template exists and caused fiven template names to be
converted to absolute paths so that they don't run afoul of zpt source
file path computation.


=== Zope3/src/zope/app/browser/form/editview.py 1.22 => 1.23 ===
--- Zope3/src/zope/app/browser/form/editview.py:1.22	Wed Apr 16 17:51:27 2003
+++ Zope3/src/zope/app/browser/form/editview.py	Fri May  2 14:27:07 2003
@@ -15,7 +15,10 @@
 $Id$
 """
 
+import os
+
 from datetime import datetime
+from zope.configuration.exceptions import ConfigurationError
 
 from zope.schema.interfaces import ValidationError
 from zope.schema import getFieldNamesInOrder
@@ -197,10 +200,13 @@
 
     if template is not None:
         template = _context.path(template)
+        template = os.path.abspath(str(template))
+        if not os.path.isfile(template):
+            raise ConfigurationError("No such file", template)
     else:
         template = default_template
 
-    template = str(template)
+
 
     names = getFieldNamesInOrder(schema)