[Zope-Checkins]
SVN: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/
quick'n dirty Z3 ZPT integration, we can edit and render....
Andreas Jung
andreas at andreas-jung.com
Thu Dec 8 15:36:04 EST 2005
Log message for revision 40645:
quick'n dirty Z3 ZPT integration, we can edit and render....
Changed:
U Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py
U Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/www/ptAdd.zpt
U Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/www/ptEdit.zpt
-=-
Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py
===================================================================
--- Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py 2005-12-08 20:07:43 UTC (rev 40644)
+++ Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/ZPT.py 2005-12-08 20:36:03 UTC (rev 40645)
@@ -21,19 +21,48 @@
from Globals import DTMLFile, ImageFile, MessageDialog, package_home, Persistent
from zLOG import LOG, ERROR, INFO
from OFS.SimpleItem import SimpleItem
+import AccessControl
from AccessControl import getSecurityManager
from zope.pagetemplate.pagetemplate import PageTemplate
from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-class ZPT(PageTemplate):
+class ZPT(SimpleItem, PageTemplate):
"Zope wrapper for Page Template using TAL, TALES, and METAL"
meta_type = 'ZPT'
+ manage_options = (
+ {'label':'Edit', 'action':'pt_editForm',
+ 'help': ('PageTemplates', 'PageTemplate_Edit.stx')},
+ {'label':'Test', 'action':'ZScriptHTML_tryForm'},
+ ) \
+ + SimpleItem.manage_options \
+
+ security = AccessControl.ClassSecurityInfo()
+
def __init__(self, id, text=None, content_type=None):
self.id = str(id)
+ security.declareProtected('View', '__call__')
+ security.declareProtected('View', 'view')
+ def view(self):
+ """view """
+ return self()
+
+ security.declareProtected('Change Page Templates',
+ 'pt_editAction', 'pt_setTitle', 'pt_edit',
+ 'pt_upload', 'pt_changePrefs')
+ def pt_editAction(self, REQUEST, title, text, content_type, expand):
+ """Change the title and document."""
+
+ print text
+ print content_type
+ self.pt_edit(text, content_type)
+ message= 'done'
+ return self.pt_editForm(manage_tabs_message=message)
+
+
pt_editForm = PageTemplateFile('www/ptEdit', globals(),
__name__='pt_editForm')
Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/www/ptAdd.zpt
===================================================================
--- Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/www/ptAdd.zpt 2005-12-08 20:07:43 UTC (rev 40644)
+++ Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/www/ptAdd.zpt 2005-12-08 20:36:03 UTC (rev 40645)
@@ -10,7 +10,7 @@
button.
</p>
-<form action="manage_addPageTemplate" method="post"
+<form action="manage_addZPT" method="post"
enctype="multipart/form-data">
<table cellspacing="0" cellpadding="2" border="0">
<tr>
Modified: Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/www/ptEdit.zpt
===================================================================
--- Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/www/ptEdit.zpt 2005-12-08 20:07:43 UTC (rev 40644)
+++ Zope/branches/ajung-zpt-integration/lib/python/Products/ZPT/www/ptEdit.zpt 2005-12-08 20:36:03 UTC (rev 40645)
@@ -39,8 +39,10 @@
</div>
</td>
<td align="left" valign="top" colspan=2>
+<!--
<a href="source.html" tal:condition="here/html">Browse HTML source</a>
<a href="source.xml" tal:condition="not:here/html">Browse XML source</a>
+-->
<br>
<input type="hidden" name="expand:int:default" value="0">
<input type="checkbox" value="1" name="expand:int"
@@ -49,6 +51,8 @@
</td>
</tr>
+ <span tal:content="python: context.pt_errors(None)" />
+<!--
<tr tal:define="errors here/pt_errors" tal:condition="errors">
<tal:block define="global body python:here.document_src({'raw':1})"/>
<td align="left" valign="middle" class="form-label">Errors</td>
@@ -57,6 +61,7 @@
<pre tal:content="python:modules['string'].join(errors, '\n')">errors</pre>
</td>
</tr>
+-->
<tr tal:define="warnings here/pt_warnings" tal:condition="warnings">
<td align="left" valign="middle" class="form-label">Warnings</td>
More information about the Zope-Checkins
mailing list