[ZPT] CVS: Packages/Products/PageTemplates (Products/DC/PageTemplates) - CHANGES.txt:1.12 ZopePageTemplate.py:1.11
evan@serenade.digicool.com
evan@serenade.digicool.com
Thu, 21 Jun 2001 10:20:49 -0400
Update of /cvs-repository/Packages/Products/PageTemplates
In directory serenade:/home/evan/Zope/pt/lib/python/Products/PageTemplates
Modified Files:
CHANGES.txt ZopePageTemplate.py
Log Message:
Enhance the manage_addPageTemplate constructor.
--- Updated File CHANGES.txt in package Packages/Products/PageTemplates --
--- CHANGES.txt 2001/06/21 14:04:42 1.11
+++ CHANGES.txt 2001/06/21 14:20:49 1.12
@@ -9,6 +9,8 @@
Features Added
- Allow any false value in tal:repeat to act as an empty sequence.
+ - manage_addPageTemplate accepts optional title and text
+ arguments, and returns the new object if REQUEST is None.
Bugs Fixed
--- Updated File ZopePageTemplate.py in package Packages/Products/PageTemplates --
--- ZopePageTemplate.py 2001/05/22 18:47:33 1.10
+++ ZopePageTemplate.py 2001/06/21 14:20:49 1.11
@@ -308,12 +308,17 @@
# Product registration and Add support
from urllib import quote
-def manage_addPageTemplate(self, id, REQUEST=None, submit=None):
+def manage_addPageTemplate(self, id, title=None, text=None,
+ REQUEST=None, submit=None):
"Add a Page Template with optional file content."
id = str(id)
if REQUEST is None:
- self._setObject(id, ZopePageTemplate(id))
+ self._setObject(id, ZopePageTemplate(id, text))
+ ob = getattr(self, id)
+ if title:
+ ob.pt_setTitle(title)
+ return ob
else:
file = REQUEST.form.get('file')
headers = getattr(file, 'headers', None)