[ZPT] CVS: Releases/Zope/lib/python/Products/PageTemplates - ZopePageTemplate.py:1.22 __init__.py:1.2

Evan Simpson evan@zope.com
Mon, 15 Oct 2001 15:52:04 -0400


Update of /cvs-repository/Releases/Zope/lib/python/Products/PageTemplates
In directory cvs.zope.org:/tmp/cvs-serv3996/Products/PageTemplates

Modified Files:
	ZopePageTemplate.py __init__.py 
Log Message:
Add om_icons protocol, and use it in PageTemplates to show error status.


=== Releases/Zope/lib/python/Products/PageTemplates/ZopePageTemplate.py 1.21 => 1.22 ===
 
 import os, AccessControl, Acquisition, sys
-from Globals import DTMLFile, MessageDialog, package_home
+from Globals import DTMLFile, ImageFile, MessageDialog, package_home
 from zLOG import LOG, ERROR, INFO
 from OFS.SimpleItem import SimpleItem
 from DateTime.DateTime import DateTime
@@ -322,6 +322,16 @@
             return self._text
         return self.read()
 
+    def om_icons(self):
+        """Return a list of icon URLs to be displayed by an ObjectManager"""
+        icons = ({'path': 'misc_/PageTemplates/zpt.gif',
+                  'alt': self.meta_type, 'title': self.meta_type},)
+        if self._v_errors:
+            icons = icons + ({'path': 'misc_/PageTemplates/exclamation.gif',
+                              'alt': 'Error',
+                              'title': 'This template has an error'},)
+        return icons
+
     def __setstate__(self, state):
         ZopePageTemplate.inheritedAttribute('__setstate__')(self, state)
         self._cook()
@@ -374,6 +384,9 @@
         if submit==" Add and Edit ": u="%s/%s" % (u,quote(id))
         REQUEST.RESPONSE.redirect(u+'/manage_main')
     return ''
+
+from Products.PageTemplates import misc_
+misc_['exclamation.gif'] = ImageFile('www/exclamation.gif', globals())
 
 def initialize(context):
     context.registerClass(


=== Releases/Zope/lib/python/Products/PageTemplates/__init__.py 1.1 => 1.2 ===
 __version__='$$'[11:-2]
 
+
+# Placeholder for Zope Product data
+misc_ = {}
+
 def initialize(context):
     # Import lazily, and defer initialization to the module
     import ZopePageTemplate