[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Formulator/Widgets/Browser - MultiItemsWidget.py:1.1.2.3
Martijn Pieters
mj@zope.com
Wed, 13 Feb 2002 00:03:35 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Formulator/Widgets/Browser
In directory cvs.zope.org:/tmp/cvs-serv14206/App/Formulator/Widgets/Browser
Modified Files:
Tag: Zope-3x-branch
MultiItemsWidget.py
Log Message:
Optimizations and code style updates:
- Use isinstance on type checks
- Test UnicodeType and StringType through StringTypes
- Remove use of the string module
- Use startswith and endswith instead of slices.
- Fix weird tests where isinstance suffices.
=== Zope3/lib/python/Zope/App/Formulator/Widgets/Browser/MultiItemsWidget.py 1.1.2.2 => 1.1.2.3 ===
from ItemsWidget import ItemsWidget
+from types import ListType
class MultiItemsWidget(ItemsWidget):
@@ -26,7 +27,7 @@
def render_items(self, field, key, value, REQUEST):
# need to deal with single item selects
- if type(value) is not type([]):
+ if not isinstance(values, ListType):
value = [value]
items = field.get_value('items')
css_class = field.get_value('css_class')