[Checkins] SVN: zope.app.form/trunk/src/zope/app/form/browser/
reverted the FileWidget improvement since it was not general
enough. Let's think it over.
Christian Zagrodnick
cz at gocept.com
Wed Jun 27 10:37:11 EDT 2007
Log message for revision 77142:
reverted the FileWidget improvement since it was not general enough. Let's think it over.
Changed:
U zope.app.form/trunk/src/zope/app/form/browser/interfaces.py
U zope.app.form/trunk/src/zope/app/form/browser/tests/test_filewidget.py
U zope.app.form/trunk/src/zope/app/form/browser/textwidgets.py
-=-
Modified: zope.app.form/trunk/src/zope/app/form/browser/interfaces.py
===================================================================
--- zope.app.form/trunk/src/zope/app/form/browser/interfaces.py 2007-06-27 14:36:21 UTC (rev 77141)
+++ zope.app.form/trunk/src/zope/app/form/browser/interfaces.py 2007-06-27 14:37:09 UTC (rev 77142)
@@ -34,40 +34,40 @@
def error():
"""Render the validation error for the widget, or return
an empty string if no error"""
-
-
+
+
class ISimpleInputWidget(IBrowserWidget, IInputWidget):
"""A widget that uses a single HTML element to collect user input."""
-
+
tag = TextLine(
title=u'Tag',
description=u'The widget HTML element.')
-
+
type = TextLine(
title=u'Type',
description=u'The element type attribute',
required=False)
-
+
cssClass = TextLine(
title=u'CSS Class',
description=u'The element class attribute.',
required=False)
-
+
extra = TextLine(
title=u'Extra',
description=u'The element extra attribute.',
required=False)
-
-
+
+
class ITextBrowserWidget(ISimpleInputWidget):
-
+
convert_missing_value = Bool(
title=u'Translate Input Value',
description=
u'If True, an empty string is converted to field.missing_value.',
default=True)
-
+
class IFormCollaborationView(Interface):
"""Views that collaborate to create a single form.
@@ -117,7 +117,7 @@
def createAndAdd(self, data):
content = <create the content from the data>
- content = self.add(content)
+ content = self.add(content)
<set after-add attributes on content>
"""
@@ -163,13 +163,13 @@
def getTerm(value):
"""Return an ITitledTokenizedTerm object for the given value
-
+
LookupError is raised if the value isn't in the source
"""
-
+
def getValue(token):
"""Return a value for a given identifier token
-
+
LookupError is raised if there isn't a value in the source.
"""
Modified: zope.app.form/trunk/src/zope/app/form/browser/tests/test_filewidget.py
===================================================================
--- zope.app.form/trunk/src/zope/app/form/browser/tests/test_filewidget.py 2007-06-27 14:36:21 UTC (rev 77141)
+++ zope.app.form/trunk/src/zope/app/form/browser/tests/test_filewidget.py 2007-06-27 14:37:09 UTC (rev 77142)
@@ -72,16 +72,7 @@
self._widget.extra = 'style="color: red"'
self.verifyResult(self._widget.hidden(), check_list)
- def testToFieldValue(self):
- widget = self._widget
- field = widget.context
- content = field.context
- field.set(content, 'file content')
- self.assertEquals('file content', widget._toFieldValue(''))
- self.assertEquals('new content',
- widget._toFieldValue(StringIO('new content')))
-
def test_suite():
return unittest.TestSuite((
unittest.makeSuite(FileWidgetTest),
Modified: zope.app.form/trunk/src/zope/app/form/browser/textwidgets.py
===================================================================
--- zope.app.form/trunk/src/zope/app/form/browser/textwidgets.py 2007-06-27 14:36:21 UTC (rev 77141)
+++ zope.app.form/trunk/src/zope/app/form/browser/textwidgets.py 2007-06-27 14:37:09 UTC (rev 77142)
@@ -475,11 +475,6 @@
def _toFieldValue(self, input):
if input is None or input == '':
- # There was no input. With File-Upload this usually means that the
- # value should *not* change. Let's try to get the old value.
- content = self.context.context
- if self.context.interface.providedBy(content):
- return self.context.get(content)
return self.context.missing_value
try:
seek = input.seek
More information about the Checkins
mailing list