Edgewall Software

Changeset 1248


Ignore:
Timestamp:
Feb 16, 2014, 7:43:20 PM (10 years ago)
Author:
hodgestar
Message:

Add isstring helper.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/genshi/compat.py

    r1156 r1248  
    3535                'Python 2 compatibility function. Not usable in Python 3.')
    3636
     37
     38# We need to test if an object is an instance of a string type in places
     39
     40if IS_PYTHON2:
     41    def isstring(obj):
     42        return isinstance(obj, basestring)
     43else:
     44    def isstring(obj):
     45        return isinstance(obj, str)
    3746
    3847# We need to differentiate between StringIO and BytesIO in places
     
    113122                return False
    114123        return True
    115 
Note: See TracChangeset for help on using the changeset viewer.