Changeset 184

Show
Ignore:
Timestamp:
05/26/08 22:35:01 (8 months ago)
Author:
poillubo
Message:

* make elghinn and guido even more happy

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pycawm/hookmanager.py

    r152 r184  
    287287        for (attr, meth) in classdict.iteritems(): 
    288288            if not hasattr(meth, '_wrapped_fun'): 
    289                 if type(meth) is FunctionType
     289                if isinstance(meth, FunctionType)
    290290                    classdict[attr] = run_hooks(meth) 
    291                 elif type(meth) is classmethod
     291                elif isinstance(meth, classmethod)
    292292                    classdict[attr] = classmethod(run_hooks( 
    293293                            meth.__get__(None, name).im_func)) 
    294                 elif type(meth) is staticmethod
     294                elif isinstance(meth, staticmethod)
    295295                    classdict[attr] = staticmethod(run_hooks( 
    296296                            meth.__get__(None, name))) 
  • trunk/pycawm/misc.py

    r183 r184  
    3939        # ClassType is the type of old-style classes 
    4040        base = tuple([cls for cls in base 
    41                       if (type(cls) in (TypeType, ClassType) and 
     41                      if (isinstance(cls, (TypeType, ClassType)) and 
    4242                          cls is not klass)]) 
    4343    try: 
     
    5050    or not). 
    5151    Return None if the argument is not correct.""" 
    52     if type(fun) in (MethodType, FunctionType): 
     52    if isinstance(fun, (MethodType, FunctionType)): 
    5353        # is fun designed to be hooked? 
    5454        if hasattr(fun, '_wrapped_fun'): 
     
    5656            fun = fun._wrapped_fun 
    5757        # normal method? 
    58         elif type(fun) is MethodType
     58        elif isinstance(fun, MethodType)
    5959            fun = fun.im_func 
    6060        # do not change the "fun" for normal functions