[Checkins] SVN: z3c.formdemo/trunk/ - Feature: Added new field "promptChoiceField" to the "All Widgets" demo

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Jun 29 01:26:26 EDT 2007


Log message for revision 77208:
  - Feature: Added new field "promptChoiceField" to the "All Widgets" demo
    demonstrating the prompt message of the select widget.
  
  

Changed:
  U   z3c.formdemo/trunk/CHANGES.txt
  U   z3c.formdemo/trunk/src/z3c/formdemo/widgets/browser.py
  U   z3c.formdemo/trunk/src/z3c/formdemo/widgets/interfaces.py

-=-
Modified: z3c.formdemo/trunk/CHANGES.txt
===================================================================
--- z3c.formdemo/trunk/CHANGES.txt	2007-06-29 04:45:45 UTC (rev 77207)
+++ z3c.formdemo/trunk/CHANGES.txt	2007-06-29 05:26:26 UTC (rev 77208)
@@ -5,6 +5,9 @@
 Version 1.2.0 (??/??/2007)
 -------------------------
 
+- Feature: Added new field "promptChoiceField" to the "All Widgets" demo
+  demonstrating the prompt message of the select widget.
+
 - Feature: Increased the integer default value of "All Widgets" demo to show
   off our new internationalized converter.
 

Modified: z3c.formdemo/trunk/src/z3c/formdemo/widgets/browser.py
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/widgets/browser.py	2007-06-29 04:45:45 UTC (rev 77207)
+++ z3c.formdemo/trunk/src/z3c/formdemo/widgets/browser.py	2007-06-29 05:26:26 UTC (rev 77208)
@@ -46,6 +46,8 @@
     choiceField = FieldProperty(interfaces.IAllFields['choiceField'])
     optionalChoiceField = FieldProperty(
         interfaces.IAllFields['optionalChoiceField'])
+    promptChoiceField = FieldProperty(
+        interfaces.IAllFields['promptChoiceField'])
     dateField = FieldProperty(interfaces.IAllFields['dateField'])
     datetimeField = FieldProperty(interfaces.IAllFields['datetimeField'])
     decimalField = FieldProperty(interfaces.IAllFields['decimalField'])
@@ -81,8 +83,12 @@
         return interfaces.IAllFields(self.context)
 
     def updateWidgets(self):
-        super(AllFieldsForm, self).updateWidgets()
+        self.widgets = zope.component.getMultiAdapter(
+            (self, self.request, self.getContent()), IWidgets)
+        self.widgets.update()
         self.widgets['hiddenField'].mode = HIDDEN_MODE
+        self.widgets['promptChoiceField'].prompt = True
+        self.widgets['promptChoiceField'].update()
 
     def __call__(self):
         self.update()

Modified: z3c.formdemo/trunk/src/z3c/formdemo/widgets/interfaces.py
===================================================================
--- z3c.formdemo/trunk/src/z3c/formdemo/widgets/interfaces.py	2007-06-29 04:45:45 UTC (rev 77207)
+++ z3c.formdemo/trunk/src/z3c/formdemo/widgets/interfaces.py	2007-06-29 05:26:26 UTC (rev 77208)
@@ -80,6 +80,12 @@
         vocabulary=vocab,
         required=False)
 
+    promptChoiceField = zope.schema.Choice(
+        title=u'Choice (Explicit Prompt)',
+        description=u'This is a choice field with an explicit prompt.',
+        vocabulary=vocab,
+        required=False)
+
     dateField = zope.schema.Date(
         title=u'Date',
         description=u'This is a Date field.',



More information about the Checkins mailing list