[Checkins] SVN: z3c.form/trunk/ Feature: add the 'prompt' attribute of the SequenceWidget to the list of adaptable attributes.
Laurent Mignon
Laurent.Mignon at softwareag.com
Wed Dec 24 04:52:48 EST 2008
Log message for revision 94302:
Feature: add the 'prompt' attribute of the SequenceWidget to the list of adaptable attributes.
Changed:
U z3c.form/trunk/CHANGES.txt
U z3c.form/trunk/src/z3c/form/browser/select.py
U z3c.form/trunk/src/z3c/form/browser/select.txt
-=-
Modified: z3c.form/trunk/CHANGES.txt
===================================================================
--- z3c.form/trunk/CHANGES.txt 2008-12-24 09:39:45 UTC (rev 94301)
+++ z3c.form/trunk/CHANGES.txt 2008-12-24 09:52:48 UTC (rev 94302)
@@ -4,6 +4,8 @@
Version 2.0.0 (2008-??-??)
--------------------------
+- Feature: add the 'prompt' attribute of the SequenceWidget to the list of
+ adaptable attributes.
- Fix: IMPORTANT - the signature of z3c.form.util.extractFileName function changed
because of spelling mistake fix in argument name. The ``allowEmtpyPostFix`` is
Modified: z3c.form/trunk/src/z3c/form/browser/select.py
===================================================================
--- z3c.form/trunk/src/z3c/form/browser/select.py 2008-12-24 09:39:45 UTC (rev 94301)
+++ z3c.form/trunk/src/z3c/form/browser/select.py 2008-12-24 09:52:48 UTC (rev 94302)
@@ -41,7 +41,7 @@
# Internal attributes
_adapterValueAttributes = SequenceWidget._adapterValueAttributes + \
- ('noValueMessage', 'promptMessage')
+ ('noValueMessage', 'promptMessage', 'prompt')
def isSelected(self, term):
return term.token in self.value
Modified: z3c.form/trunk/src/z3c/form/browser/select.txt
===================================================================
--- z3c.form/trunk/src/z3c/form/browser/select.txt 2008-12-24 09:39:45 UTC (rev 94301)
+++ z3c.form/trunk/src/z3c/form/browser/select.txt 2008-12-24 09:52:48 UTC (rev 94302)
@@ -213,6 +213,28 @@
>>> widget.promptMessage
u'please select a value'
+Additionally, the select widget also allows dynamic value for the ``prompt``
+attribute . Initially, value is ``False``:
+
+ >>> widget.prompt = False
+ >>> widget.prompt
+ False
+
+Let's now register an attribute value:
+
+ >>> from z3c.form.widget import StaticWidgetAttribute
+ >>> AllowPrompt = StaticWidgetAttribute(True)
+
+ >>> import zope.component
+ >>> zope.component.provideAdapter(AllowPrompt, name='prompt')
+
+After updating the widget, the value for the prompt attribute changed to the
+value provided by the adapter:
+
+ >>> widget.update()
+ >>> widget.prompt
+ True
+
Display Widget
--------------
More information about the Checkins
mailing list