Skip to content

Commit

Permalink
Merge branch 'master' into dictmulti3.0
Browse files Browse the repository at this point in the history
Conflicts:
	CHANGES.txt
  • Loading branch information
djay committed Apr 9, 2013
2 parents c3e5ca2 + 1b896f3 commit a26f72f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
10 changes: 8 additions & 2 deletions CHANGES.txt
Expand Up @@ -2,11 +2,17 @@
CHANGES
=======

3.0.0a3 (unreleased)
3.0.0a4 (unreleased)
--------------------

- Added support for IDict Widget in MultiWidget.
- Updated pt_BR translation


3.0.0a3 (2013-04-08)
--------------------

- Updated pt_BR translation.
- Fixed a bug where file input value was interpeted as UTF-8.


3.0.0a2 (2013-02-26)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -61,7 +61,7 @@ def alltests():

setup(
name='z3c.form',
version='3.0.0a3.dev0',
version='3.0.0a4.dev0',
author="Stephan Richter, Roger Ineichen and the Zope Community",
author_email="zope-dev@zope.org",
description="An advanced form and widget framework for Zope 3",
Expand Down
4 changes: 2 additions & 2 deletions src/z3c/form/browser/README.txt
Expand Up @@ -342,7 +342,7 @@ Bytes

>>> widget.mode = interfaces.DISPLAY_MODE
>>> widget.render().strip('\r\n')
u'<span id="foo" class="file-widget required bytes-field">Default bytes</span>'
u'<span id="foo" class="file-widget required bytes-field"></span>'

Calling the widget will return the widget including the layout

Expand All @@ -355,7 +355,7 @@ Calling the widget will return the widget including the layout
</label>
</div>
<div class="widget">
<span id="foo" class="file-widget required bytes-field">Default bytes</span>
<span id="foo" class="file-widget required bytes-field"></span>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/z3c/form/converter.py
Expand Up @@ -221,7 +221,7 @@ class FileUploadDataConverter(BaseDataConverter):

def toWidgetValue(self, value):
"""See interfaces.IDataConverter"""
return value.decode()
return None

def toFieldValue(self, value):
"""See interfaces.IDataConverter"""
Expand Down
11 changes: 5 additions & 6 deletions src/z3c/form/converter.txt
Expand Up @@ -427,11 +427,11 @@ fields storage stub ...
and a ``FileUpload`` component:

>>> try:
... from cStringIO import StringIO
... from cStringIO import StringIO as BytesIO
... except ImportError:
... from io import StringIO
... from io import BytesIO
>>> from zope.publisher.browser import FileUpload
>>> myfile = StringIO('File upload contents.')
>>> myfile = BytesIO(b'File upload contents.')
>>> aFieldStorage = FieldStorageStub(myfile)
>>> myUpload = FileUpload(aFieldStorage)

Expand All @@ -457,7 +457,7 @@ the upload, since you are normaly not able to upload a file without a filename:
... self.file = file
... self.headers = {}
... self.filename = ''
>>> myfile = StringIO('')
>>> myfile = BytesIO(b'')
>>> aFieldStorage = EmptyFilenameFieldStorageStub(myfile)
>>> myUpload = FileUpload(aFieldStorage)
>>> bytes = zope.schema.Bytes()
Expand All @@ -481,8 +481,7 @@ There is also a ``ValueError`` if we don't get a seekable file from the
When converting to the widget value, not conversion should be done, since
bytes are not convertable in that sense.

>>> fudc.toWidgetValue(b'bytes')
'bytes'
>>> fudc.toWidgetValue(b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x04')

When the file upload widget is not used and a text-based widget is desired,
then the regular field data converter will be chosen. Using a text widget,
Expand Down

0 comments on commit a26f72f

Please sign in to comment.