[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/ZPTPage - ZPTPage.py:1.4 configure.zcml:1.6
Stephan Richter
srichter@cbu.edu
Fri, 19 Jul 2002 09:13:04 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/ZPTPage
In directory cvs.zope.org:/tmp/cvs-serv24805/lib/python/Zope/App/OFS/Content/ZPTPage
Modified Files:
ZPTPage.py configure.zcml
Log Message:
Okay, I finished the Forms work. Schema and Forms completely replace the
old Formulator code now. I have switched all the Content objects to using
Schema + Forms; especially the SQL Script has an interesting demo on how
to write your custom fields.
However, I am not satisfied with all my design decisions. There is still
a lot of work to be done in Converters and Widgets. Please contact Martijn
and/or me if you would like to help.
=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/ZPTPage.py 1.3 => 1.4 ===
#
##############################################################################
"""
-
$Id$
"""
-
from Interface import Interface
from Interface.Attribute import Attribute
+import Schema
from Persistence import Persistent
-from Zope.PageTemplate.PageTemplate import PageTemplate
-from Zope.App.PageTemplate.Engine import AppPT
+
from Zope.ContextWrapper import ContextMethod
from Zope.Proxy.ContextWrapper import getWrapperContainer
from Zope.Security.Proxy import ProxyFactory
+
+from Zope.App.OFS.Annotation.IAnnotatable import IAnnotatable
from Zope.App.OFS.Content.IFileContent import IFileContent
+from Zope.PageTemplate.PageTemplate import PageTemplate
+from Zope.App.PageTemplate.Engine import AppPT
class IZPTPage(Interface):
"""ZPT Pages are a persistent implementation of Page Templates.
@@ -35,13 +37,19 @@
"""
def setSource(text, content_type='text/html'):
- """Save the source of the page template.
- """
-
+ """Save the source of the page template."""
def getSource():
- """Get the source of the page template.
- """
+ """Get the source of the page template."""
+
+
+class SZPTPage(Schema.Schema):
+ source = Schema.Str(
+ id="source",
+ title="Source",
+ description="""The source od the page template.""",
+ required=1)
+
class IRenderZPTPage(Interface):
@@ -60,28 +68,21 @@
class ZPTPage(AppPT, PageTemplate, Persistent):
# XXX Putting IFileContent at the end gives an error!
- __implements__ = IFileContent, IZPTPage, IRenderZPTPage
-
- ############################################################
- # Implementation methods for interface
- # Zope.App.OFS.ZPTPage.ZPTPage.IZPTPage
+ __implements__ = IFileContent, SZPTPage, IZPTPage, IRenderZPTPage, \
+ IAnnotatable
def getSource(self):
- '''See interface IZPTPage'''
+ '''See interface Zope.App.OFS.ZPTPage.ZPTPage.IZPTPage'''
return self.read()
def setSource(self, text, content_type='text/html'):
- '''See interface IZPTPage'''
-
+ '''See interface Zope.App.OFS.ZPTPage.ZPTPage.IZPTPage'''
if isinstance(text, unicode):
text = text.encode('utf-8')
self.pt_edit(text, content_type)
- #
- ############################################################
-
def pt_getContext(self, instance, request, **_kw):
# instance is a View component
@@ -106,3 +107,6 @@
render = ContextMethod(render)
+
+ source = property(getSource, setSource, None,
+ """Source of the Page Template.""")
=== Zope3/lib/python/Zope/App/OFS/Content/ZPTPage/configure.zcml 1.5 => 1.6 ===
description="A simple, content-based Page Template" />
<require permission="Zope.View"
attributes="content_type __call__" />
-
+ <require permission="Zope.View"
+ interface=".ZPTPage.SZPTPage" />
<require permission="Zope.ManageContent"
interface=".ZPTPage.IZPTPage" />
<require permission="Zope.View"