[Zope-Checkins] CVS: Zope3/lib/python/Zope/Misc - DateTimeParse.py:1.1.2.3
Martijn Pieters
mj@zope.com
Wed, 13 Feb 2002 00:03:38 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/Misc
In directory cvs.zope.org:/tmp/cvs-serv14206/Misc
Modified Files:
Tag: Zope-3x-branch
DateTimeParse.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/Misc/DateTimeParse.py 1.1.2.2 => 1.1.2.3 ===
import re, math, DateTimeZone
-from types import StringType, UnicodeType
+from types import StringTypes
from time import \
time as _time, gmtime, localtime, strftime, daylight, timezone, altzone
try: from time import tzname
@@ -460,7 +460,7 @@
will raise a DateError, while invalid time or timezone components
will raise a DateTimeError.
"""
- if type(arg) not in (StringType,UnicodeType):
+ if not isinstance(arg, StringTypes):
raise TypeError, 'Expected a string argument'
if not arg: