[Zope3-checkins] CVS: Zope3/lib/python/Zope/PageTemplate - IMacrosAttribute.py:1.1 PageTemplate.py:1.6

Steve Alexander steve@cat-box.net
Tue, 22 Oct 2002 10:18:41 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/PageTemplate
In directory cvs.zope.org:/tmp/cvs-serv26545

Modified Files:
	PageTemplate.py 
Added Files:
	IMacrosAttribute.py 
Log Message:
Asserted that PageTemplates have a macros attribute containing macros,
accessible by __getitem__ lookup. This assertion is made using the
IMacrosAttribute interface.


=== Added File Zope3/lib/python/Zope/PageTemplate/IMacrosAttribute.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# 
##############################################################################
"""Interface that describes the 'macros' attribute of a PageTemplate.

$Id: IMacrosAttribute.py,v 1.1 2002/10/22 14:18:41 stevea Exp $
"""
from Interface import Interface
from Interface.Attribute import Attribute

class IMacrosAttribute(Interface):

    macros = Attribute("An object that implements the __getitem__ "
                       "protocol, containing page template macros.")



=== Zope3/lib/python/Zope/PageTemplate/PageTemplate.py 1.5 => 1.6 ===
--- Zope3/lib/python/Zope/PageTemplate/PageTemplate.py:1.5	Tue Oct 22 10:11:05 2002
+++ Zope3/lib/python/Zope/PageTemplate/PageTemplate.py	Tue Oct 22 10:18:41 2002
@@ -25,6 +25,7 @@
 from Zope.TAL.TALGenerator import TALGenerator
 from Zope.TAL.TALInterpreter import TALInterpreter
 from Engine import Engine
+from IMacrosAttribute import IMacrosAttribute
 # Don't use cStringIO here!  It's not unicode aware.
 from StringIO import StringIO
 
@@ -61,6 +62,8 @@
         passed to the TALES expression engine, then calls pt_render()
         to perform the rendering.
     """
+
+    __implements__ = IMacrosAttribute
 
     content_type = 'text/html'
     expand = 1