[Zope3-checkins] CVS: Zope3/src/zope/app/interfaces/content -
zpt.py:1.5
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Aug 21 11:19:55 EDT 2003
Update of /cvs-repository/Zope3/src/zope/app/interfaces/content
In directory cvs.zope.org:/tmp/cvs-serv8485/src/zope/app/interfaces/content
Modified Files:
zpt.py
Log Message:
Final HEAD checkin of "Inline Code Support in TAL". For detailed messages
during the development, see "srichter-inlinepython-branch". I tested the
code with both, Python 2.2.3 and Python 2.3 and all works fine.
Here an example of what you can do:
<script type="text/server-python">
print "Hello World!"
</script>
and
<p tal:script="text/server-python">
print "Hello World!"
</p>
A more elaborate example would be:
<html><body>
<script type="text/server-python">
global x
x = "Hello World!"
</script>
<b tal:content="x" />
</body></html>
This support is currently only available in "Templated Pages" after you
activate the hook using the "Inline Code" screen.
=== Zope3/src/zope/app/interfaces/content/zpt.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/interfaces/content/zpt.py:1.4 Thu Apr 10 05:34:29 2003
+++ Zope3/src/zope/app/interfaces/content/zpt.py Thu Aug 21 10:19:24 2003
@@ -11,21 +11,17 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
+"""Templated Page Content Component Interfaces
+
$Id$
"""
-
-import zope.schema
+from zope.schema import SourceText, Bool
from zope.interface import Interface, Attribute
from zope.app.i18n import ZopeMessageIDFactory as _
class IZPTPage(Interface):
- """ZPT Pages are a persistent implementation of Page Templates.
+ """ZPT Pages are a persistent implementation of Page Templates."""
- Note: I introduced some new methods whose functionality is
- actually already covered by some other methods but I
- want to start enforcing a common coding standard.
- """
def setSource(text, content_type='text/html'):
"""Save the source of the page template.
@@ -36,14 +32,25 @@
def getSource():
"""Get the source of the page template."""
- source = zope.schema.SourceText(
- title=_(u"Source"),
- description=_(u"""The source of the page template."""),
+ source = SourceText(
+ title=_("Source"),
+ description=_("The source of the page template."),
+ required=True)
+
+ expand = Bool(
+ title=_("Expand macros"),
+ description=_("Expand Macros so that they all are shown in the "
+ "code."),
+ default=False,
+ required=True)
+
+ evaluateInlineCode = Bool(
+ title=_("Evaluate Inline Code"),
+ description=_("Evaluate code snippets in TAL. We usually discourage "
+ "people from using this feature."),
+ default=False,
required=True)
- expand = zope.schema.Bool(
- title=_(u"Expand macros"),
- )
class IRenderZPTPage(Interface):
More information about the Zope3-Checkins
mailing list