[Zope-Checkins] CVS: Zope3/lib/python/Zope/Server/medusa - filesys.py:1.9.72.1 ftp_server.py:1.18.42.1 logger.py:1.13.20.1
Martijn Pieters
mj@zope.com
Wed, 13 Feb 2002 00:03:40 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Server/medusa
In directory cvs.zope.org:/tmp/cvs-serv14206/Server/medusa
Modified Files:
Tag: Zope-3x-branch
filesys.py ftp_server.py logger.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/medusa/filesys.py 1.9 => 1.9.72.1 ===
p = self.path_module.normpath (path)
# remove 'dangling' cdup's.
- if len(p) > 2 and p[:3] == '/..':
+ if len(p) > 2 and p.startswith('/..'):
p = '/'
return p
=== Zope3/lib/python/Zope/Server/medusa/ftp_server.py 1.18 => 1.18.42.1 ===
help_lines = []
for attr in attrs:
- if attr[:4] == 'cmd_':
+ if attr.startswith('cmd_'):
x = getattr (self, attr)
if type(x) == type(self.cmd_help):
if x.__doc__:
=== Zope3/lib/python/Zope/Server/medusa/logger.py 1.13 => 1.13.20.1 ===
def log (self, message):
- if message[-2:] != '\r\n':
+ if not message.endswith('\r\n'):
self.socket.push (message + '\r\n')
else:
self.socket.push (message)