[Zope3-checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/DTMLPage - DTMLPage.py:1.2 configure.zcml:1.2
Stephan Richter
srichter@cbu.edu
Fri, 19 Jul 2002 09:13:01 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/DTMLPage
In directory cvs.zope.org:/tmp/cvs-serv24805/lib/python/Zope/App/OFS/Content/DTMLPage
Modified Files:
DTMLPage.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/DTMLPage/DTMLPage.py 1.1 => 1.2 ===
#
##############################################################################
"""
-
$Id$
"""
-
from Interface import Interface
from Interface.Attribute import Attribute
+import Schema
from Persistence import Persistent
from Zope.ContextWrapper import ContextMethod
@@ -26,21 +25,26 @@
from Zope.DocumentTemplate.pDocumentTemplate import MultiMapping
from Zope.DocumentTemplate.DT_HTML import HTML
+from Zope.App.OFS.Annotation.IAnnotatable import IAnnotatable
from Zope.App.OFS.Content.IFileContent import IFileContent
class IDTMLPage(Interface):
- """DTML Pages are a persistent implementation of DTML.
- """
-
+ """DTML Pages are a persistent implementation of DTML."""
+
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 SDTMLPage(Schema.Schema):
+ source = Schema.Str(
+ id="source",
+ title="Source",
+ description="""The source od the page template.""",
+ required=1)
class IRenderDTMLPage(Interface):
@@ -60,31 +64,22 @@
class DTMLPage(Persistent):
# XXX Putting IFileContent at the end gives an error!
- __implements__ = IFileContent, IDTMLPage, IRenderDTMLPage
+ __implements__ = IFileContent, IDTMLPage, SDTMLPage, IRenderDTMLPage, \
+ IAnnotatable
def __init__(self, source=''):
self.setSource(source)
-
- ############################################################
- # Implementation methods for interface
- # Zope.App.OFS.DTMLPage.DTMLPage.IDTMLPage
-
def getSource(self):
'''See interface IDTMLPage'''
return self.template.read()
-
def setSource(self, text, content_type='text/html'):
'''See interface IDTMLPage'''
self.template = HTML(text.encode('utf-8'))
self.content_type = content_type
-
- ###########################################
- # Zope.App.OFS.DTMLPage.DTMLPage.IDTMLRenderPage
-
def render(self, request, *args, **kw):
"""See interface IDTMLRenderPage"""
@@ -97,9 +92,10 @@
return self.template(instance, request, **kw)
- #
- ############################################################
render = ContextMethod(render)
__call__ = render
+
+ source = property(getSource, setSource, None,
+ """Source of the DTML Page.""")
=== Zope3/lib/python/Zope/App/OFS/Content/DTMLPage/configure.zcml 1.1 => 1.2 ===
<require permission="Zope.ManageContent"
interface=".DTMLPage.IDTMLPage" />
<require permission="Zope.View"
+ interface=".DTMLPage.SDTMLPage" />
+ <require permission="Zope.View"
interface=".DTMLPage.IRenderDTMLPage" />
</content>