[Zope3-checkins] CVS: Zope3/src/zope/app/browser/security - permissionwidget.py:1.9.28.1
Garrett Smith
garrett@mojave-corp.com
Tue, 22 Jul 2003 09:01:17 -0400
Update of /cvs-repository/Zope3/src/zope/app/browser/security
In directory cvs.zope.org:/tmp/cvs-serv26193/src/zope/app/browser/security
Modified Files:
Tag: garrett-widgets-branch
permissionwidget.py
Log Message:
CVS: ----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS: Tag: garrett-widgets-branch
CVS: src/zope/app/browser/cache/cacheable.py
CVS: src/zope/app/browser/component/interfacewidget.py
CVS: src/zope/app/browser/component/tests/test_interfacewidget.py
CVS: src/zope/app/browser/form/editview.py
CVS: src/zope/app/browser/form/vocabularywidget.py
CVS: src/zope/app/browser/form/widget.py
CVS: src/zope/app/browser/form/tests/test_browserwidget.py
CVS: src/zope/app/browser/form/tests/test_checkboxwidget.py
CVS: src/zope/app/browser/form/tests/test_datetimewidget.py
CVS: src/zope/app/browser/form/tests/test_editview.py
CVS: src/zope/app/browser/form/tests/test_floatwidget.py
CVS: src/zope/app/browser/form/tests/test_intwidget.py
CVS: src/zope/app/browser/form/tests/test_objectwidget.py
CVS: src/zope/app/browser/form/tests/test_sequencewidget.py
CVS: src/zope/app/browser/form/tests/test_vocabularywidget.py
CVS: src/zope/app/browser/security/permissionwidget.py
CVS: src/zope/app/browser/services/field.py
CVS: src/zope/app/browser/services/registration/__init__.py
CVS: src/zope/app/browser/services/tests/test_field_widget.py
CVS: src/zope/app/browser/skins/rotterdam/editingwidgets.py
CVS: src/zope/app/dav/configure.zcml src/zope/app/dav/widget.py
CVS: src/zope/app/form/utility.py src/zope/app/form/widget.py
CVS: src/zope/app/form/tests/test_utility.py
CVS: src/zope/app/form/tests/test_widget_geddon_deprecations.py
CVS: src/zope/app/interfaces/form.py
CVS: src/zope/schema/_bootstrapfields.py
CVS: ----------------------------------------------------------------------
Several changes related to widgets:
- Changed haveData to hasData.
- Propogated the use of Field.missing_value as an alternative to
explicit checks for None and '' (empty string).
- Changed the default implementation of hasData (was haveData) to return
True only if the one of the following was true:
- setData had been called for the widget. Per IWidget, values passed to
setData override all other data sources for a widget.
- There is a value in the request form that corresponds to the widget
field.
Prior to this change, hasData would return False if the widget's data
equaled the field's missing value. E.g., a text widget with an empty
string would return False, indicating that it has no data, even though
the empty string, a legitmate value, was submitted in the request.
This change required a handful of other changes to reflect the new
logic.
The bulk of this change effected widget.py. To see how the new logic
implementation of hasData effected widgets, see test_browserwidget.py
and test_utility.py.
- Modified the update logic for objects to skip fields that are not
present in the request form. Prior to this change, unspecified values
(i.e. values not in the request form) would cause default values to be
set for corresponding object fields.
- Exposed missing_value in initializer for Field - developers can now
specify a missing value for a schema field.
- Changed the default implementation of field validation. Prior to this
change, validation failed if a required value was missing. Now validation
is limited to validating non-missing values and the check for required
values is performed elsewhere.
- Text fields have a missing_value of '' (empty string) instead of None.
- Widget related error classes have been revamped:
- WidgetInputError, the base class for all widget related errors, now
provides two attributes: widget, the widget associated with the
error, and error_msg, a string describing the error,
- WidgetInputError implements 'args' so it can be rendered like other
errors.
- MissingInputError uses a standard error message.
- All uses of WidgetInputError and its subclasses have been updated
to use the new class.
- Deleted class zope.app.browser.form.widget.PossiblyEmptyMeansMissing.
This capability is now handled by setting a field's missing_value to ''
(empty string).
- Changed widget's _showData:
- Renamed to getUnconvertedData to clarify the method meaning and signal
its use as a public method.
- Positioned the method as a complement to getData, which returns data
in its converted form. getUnconvertedData returns data in its
unconvereted form using _unconvert.
- Renamed the 'force' argument used in various setUpWidget methods in
utility.py to 'ignore_unspecified'. This argument is set to True to
ensure that fields that are not in a form are not used to update their
corresponding widget. This argument should be true during object
updates (see editview.py) to ensure that unspecified fields are not
updated.
- Removed the 'strict' argument from applyWidgetChanges since no one was
using it and there's no clear application for it.
=== Zope3/src/zope/app/browser/security/permissionwidget.py 1.9 => 1.9.28.1 ===
--- Zope3/src/zope/app/browser/security/permissionwidget.py:1.9 Wed Apr 30 19:37:54 2003
+++ Zope3/src/zope/app/browser/security/permissionwidget.py Tue Jul 22 09:00:42 2003
@@ -33,7 +33,7 @@
try:
permission_id = permission_id.encode('ascii')
except UnicodeError, v:
- raise ConversionError("Invalid textual data", v)
+ raise ConversionError(self, "Invalid textual data")
@@ -62,7 +62,7 @@
if permission.find(search_string)!=-1]
select_name = self.name
- selected = self._showData()
+ selected = self.getUnconvertedData()
options = ['<option value=\"\">---select permission---</option>']
for permission in permissions: