[z3-checkins] r28626 - z3/Sfive/trunk

philikon at codespeak.net philikon at codespeak.net
Sat Jun 10 17:02:13 CEST 2006


Author: philikon
Date: Sat Jun 10 17:02:08 2006
New Revision: 28626

Modified:
   z3/Sfive/trunk/browser.py
Log:
formlib-based forms


Modified: z3/Sfive/trunk/browser.py
==============================================================================
--- z3/Sfive/trunk/browser.py	(original)
+++ z3/Sfive/trunk/browser.py	Sat Jun 10 17:02:08 2006
@@ -2,8 +2,15 @@
 import datetime
 import docutils.core
 from docutils.writers import s5_html
+
+import zope.component
 from zope.traversing.browser import absoluteURL
 from zope.publisher.browser import BrowserPage
+from zope.formlib.form import AddForm, EditForm, Fields, applyChanges
+from zope.i18nmessageid import MessageFactory
+_ = MessageFactory('sfive')
+
+from Products.Sfive.interfaces import IPresentation
 
 class ViewPresentation(BrowserPage):
 
@@ -24,3 +31,16 @@
         today = datetime.date.today()
         #XXX should use locale formatter here
         return today.strftime("%d %b %Y")
+
+class AddPresentation(AddForm):
+    form_fields = Fields(IPresentation)
+    label = _(u'Add Presentation')
+
+    def create(self, data):
+        presentation = zope.component.createObject(u'sfive.Presentation')
+        applyChanges(presentation, self.form_fields, data)
+        return presentation
+
+class EditPresentation(EditForm):
+    form_fields = Fields(IPresentation)
+    label = _(u'Edit Presentation')


More information about the z3-checkins mailing list