[Zope3-checkins] SVN: Zope3/trunk/ content_type is editable in the
ZMI.
Yusei Tahara
yusei at domen.cx
Wed Mar 21 22:05:15 EDT 2007
Log message for revision 73434:
content_type is editable in the ZMI.
Changed:
U Zope3/trunk/doc/CHANGES.txt
U Zope3/trunk/src/zope/app/zptpage/browser/ftests.py
U Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py
U Zope3/trunk/src/zope/app/zptpage/configure.zcml
U Zope3/trunk/src/zope/app/zptpage/interfaces.py
-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt 2007-03-22 01:56:15 UTC (rev 73433)
+++ Zope3/trunk/doc/CHANGES.txt 2007-03-22 02:05:14 UTC (rev 73434)
@@ -111,6 +111,8 @@
the trasaction was doomed. Related to:
http://www.zope.org/Collectors/Zope3-dev/655.
+ - ZPTPage's content_type is now editable in the ZMI.
+
Restructuring
- Moved IBroken to zope.app.broken.interfaces to avoid cyclic imports.
Modified: Zope3/trunk/src/zope/app/zptpage/browser/ftests.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/browser/ftests.py 2007-03-22 01:56:15 UTC (rev 73433)
+++ Zope3/trunk/src/zope/app/zptpage/browser/ftests.py 2007-03-22 02:05:14 UTC (rev 73434)
@@ -96,6 +96,7 @@
body = response.getBody()
self.assert_('Source' in body)
self.assert_('Expand macros' in body)
+ self.assert_('Content Type' in body)
self.assert_(escape(self.content) in body)
self.checkForBrokenLinks(body, '/zptpage/@@edit.html', 'mgr:mgrpw')
@@ -107,6 +108,7 @@
form={'form.source': u'<h1>A ZPT Page</h1>\n',
'form.expand.used': u'',
'form.expand': u'on',
+ 'form.content_type': u'text/html',
'form.actions.apply': u'Apply'},
basic='mgr:mgrpw')
self.assertEqual(response.getStatus(), 200)
@@ -117,6 +119,7 @@
zptpage = root['zptpage']
self.assertEqual(zptpage.source, '<h1>A ZPT Page</h1>\n')
self.assertEqual(zptpage.expand, True)
+ self.assertEqual(zptpage.content_type, 'text/html')
def testIssue199(self):
# This is a test to protect us against issue 199 in the future
Modified: Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py 2007-03-22 01:56:15 UTC (rev 73433)
+++ Zope3/trunk/src/zope/app/zptpage/browser/zptpage.py 2007-03-22 02:05:14 UTC (rev 73434)
@@ -38,6 +38,7 @@
form_fields = zope.formlib.form.Fields(
zope.app.zptpage.interfaces.IZPTPage,
+ zope.app.zptpage.interfaces.IRenderZPTPage,
render_context=True).omit('evaluateInlineCode')
def setUpWidgets(self, ignore_request=False):
Modified: Zope3/trunk/src/zope/app/zptpage/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/configure.zcml 2007-03-22 01:56:15 UTC (rev 73433)
+++ Zope3/trunk/src/zope/app/zptpage/configure.zcml 2007-03-22 02:05:14 UTC (rev 73434)
@@ -21,7 +21,7 @@
<require
permission="zope.ManageContent"
interface=".interfaces.IZPTPage"
- set_attributes="source expand evaluateInlineCode"
+ set_attributes="source expand evaluateInlineCode content_type"
/>
<require
permission="zope.View"
Modified: Zope3/trunk/src/zope/app/zptpage/interfaces.py
===================================================================
--- Zope3/trunk/src/zope/app/zptpage/interfaces.py 2007-03-22 01:56:15 UTC (rev 73433)
+++ Zope3/trunk/src/zope/app/zptpage/interfaces.py 2007-03-22 02:05:14 UTC (rev 73434)
@@ -15,8 +15,8 @@
$Id$
"""
-from zope.schema import SourceText, Bool
-from zope.interface import Interface, Attribute
+from zope.schema import SourceText, Bool, TextLine
+from zope.interface import Interface
from zope.app.i18n import ZopeMessageFactory as _
class IZPTPage(Interface):
@@ -54,7 +54,11 @@
class IRenderZPTPage(Interface):
- content_type = Attribute('Content type of generated output')
+ content_type = TextLine(
+ title=_("Content Type"),
+ description=_("Content type of generated output"),
+ default=u"text/html",
+ required=True)
def render(request, *args, **kw):
"""Render the page template.
More information about the Zope3-Checkins
mailing list