[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/File - File.py:1.1.2.3
Martijn Pieters
mj@zope.com
Wed, 13 Feb 2002 00:03:36 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/File
In directory cvs.zope.org:/tmp/cvs-serv14206/App/OFS/File
Modified Files:
Tag: Zope-3x-branch
File.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/OFS/File/File.py 1.1.2.2 => 1.1.2.3 ===
# Handle case when data is a string
- if type(data) is StringType:
+ if isinstance(data, StringType):
size = len(data)
if size < MAXCHUNKSIZE:
self._data, self._size = FileChunk(data), size
@@ -92,7 +92,7 @@
return None
# Handle case when data is a string
- if type(data) is NoneType:
+ if isinstance(data, NoneType):
self._data, self._size = None, 0
return None