[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server - Chunking.py:1.1.2.3

Martijn Pieters mj@zope.com
Wed, 13 Feb 2002 00:03:40 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Server
In directory cvs.zope.org:/tmp/cvs-serv14206/Server

Modified Files:
      Tag: Zope-3x-branch
	Chunking.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/Server/Chunking.py 1.1.2.2 => 1.1.2.3 ===
                 # Receive the trailer.
                 trailer = self.trailer + s
-                if trailer[:2] == '\r\n':
+                if trailer.startswith('\r\n'):
                     # No trailer.
                     self.completed = 1
                     return orig_size - (len(trailer) - 2)
-                elif trailer[:1] == '\n':
+                elif trailer.startswith('\n'):
                     # No trailer.
                     self.completed = 1
                     return orig_size - (len(trailer) - 1)