Changeset 162 for trunk/module/pg.py


Ignore:
Timestamp:
Aug 16, 2004, 6:00:45 AM (15 years ago)
Author:
darcy
Message:

Switch to using isinstance instead of type. This allows us to send objects
that are subclassed from the base types.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/module/pg.py

    r160 r162  
    6666        def _do_debug(self, s):
    6767                if not self.debug: return
    68                 if type(self.debug) == StringType: print self.debug % s
    69                 if type(self.debug) == FunctionType: self.debug(s)
    70                 if type(self.debug) == FileType: print >> self.debug, s
     68                if isinstance(self.debug, StringType): print self.debug % s
     69                if isinstance(self.debug, FunctionType): self.debug(s)
     70                if isinstance(self.debug, FileType): print >> self.debug, s
    7171
    7272        # wrap close so we can track state
     
    9595                        then replace the __pkeys dictionary with it."""
    9696                # Get all the primary keys at once
    97                 if type(newpkey) == DictType:
     97                if isinstance(newpkey, DictType):
    9898                        self.__pkeys = newpkey
    9999                        return
     
    137137                        will become the new attribute names dictionary."""
    138138
    139                 if type(newattnames) == DictType:
     139                if isinstance(newattnames, DictType):
    140140                        self.__attnames = newattnames
    141141                        return
     
    200200                fnames = self.get_attnames(xcl)
    201201
    202                 if type(arg) == DictType:
     202                if isinstance(arg, DictType):
    203203                        # To allow users to work with multiple tables we munge the
    204204                        # name when the key is "oid"
Note: See TracChangeset for help on using the changeset viewer.