(self, obj, k, v)
Figure out what types of type checks are needed on the field and run them.
Figure out what types of type checks are needed on the field and run them.
Figure out what types of type checks are needed on the field and run them .
def _run_type_checks(self, obj, k, v):
        """
        Figure out what types of type checks are needed on the field and run them.
        """
        vt = type(v)

        # if self.of is set, we will type check the collection contents as well
        if self.of:

            if vt in (list, tuple):
                self._type_check_list(obj, k, v)
            elif type(v) == dict:
                self._type_check_dict(obj, k, v)

        elif (v is not None) and (not issubclass(vt, self.kind)) and not issubclass(vt, Lookup):
            # we requested a simple type check, but don't care about contents if the contents are supposed to be a dict or list
            # an Eval type also gets to slide by (and may POSSIBLY have fun at runtime)
            raise Exception("%s, field %s: value(%s) is not (%s) but (%s)" % (obj, k, v, self.kind, vt))
def _run_type_checks ( self , obj , k , v ) : vt = type ( v ) # if self.of is set, we will type check the collection contents as well if self . of : if vt in ( list , tuple ) : self . _type_check_list ( obj , k , v ) elif type ( v ) == dict : self . _type_check_dict ( obj , k , v ) elif ( v is not None ) and ( not issubclass ( vt , self . kind ) ) and not issubclass ( vt , Lookup ) : # we requested a simple type check, but don't care about contents if the contents are supposed to be a dict or list # an Eval type also gets to slide by (and may POSSIBLY have fun at runtime) raise Exception ( "%s, field %s: value(%s) is not (%s) but (%s)" % ( obj , k , v , self . kind , vt ) )