Changeset 176


Ignore:
Timestamp:
Sep 21, 2004, 10:26:59 AM (15 years ago)
Author:
darcy
Message:

Use isinstance instead of type to test object types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/pgdb.py

    r175 r176  
    245245except (NameError, AttributeError):
    246246  def _quote(x):
    247           if type(x) == DateTime.DateTimeType:
     247          if isinstance(x, DateTime.DateTimeType):
    248248                x = str(x)
    249249          if isinstance(x, types.StringType):
     
    251251                                  string.replace(str(x), '\\', '\\\\'), "'", "''") + "'"
    252252
    253           elif type(x, (types.IntType, types.LongType, types.FloatType)):
     253          elif isinstance(x, (types.IntType, types.LongType, types.FloatType)):
    254254                  pass
    255255          elif x is None:
    256256                  x = 'NULL'
    257           elif type(x, (types.ListType, types.TupleType)):
     257          elif isinstance(x, (types.ListType, types.TupleType)):
    258258                  x = '(%s)' % string.join(map(lambda x: str(_quote(x)), x), ',')
    259259          elif hasattr(x, '__pg_repr__'):
Note: See TracChangeset for help on using the changeset viewer.