[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Content/File - File.py:1.3
Marius Gedminas
mgedmin@delfi.lt
Mon, 24 Jun 2002 11:41:10 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Content/File
In directory cvs.zope.org:/tmp/cvs-serv7013
Modified Files:
File.py
Log Message:
Made File.setData accept Unicode strings. Someone should probably check
if that's really meaningful.
=== Zope3/lib/python/Zope/App/OFS/Content/File/File.py 1.2 => 1.3 ===
import Persistence
-from types import StringType, NoneType
+from types import StringType, UnicodeType, NoneType
from FileChunk import FileChunk
from IFile import IFile
@@ -82,6 +82,9 @@
'''See interface IFile'''
# Handle case when data is a string
+ if isinstance(data, UnicodeType):
+ data = data.encode('UTF-8')
+
if isinstance(data, StringType):
size = len(data)
if size < MAXCHUNKSIZE: