Ejemplo n.º 1
0
 def key_match_invariant(pmap):
     for (key, value) in pmap.items():
         if key != getattr(value, attribute):
             return (
                 False, "{} is not correct key for {}".format(key, value)
             )
     return (True, "")
Ejemplo n.º 2
0
    def key_match_invariant(pmap):
        # Either the field allows None, in which case this is necessary,
        # or it doesn't in which case this won't do any harm since
        # invalidity of None will be enforced elsewhere:
        if pmap is None:
            return (True, "")

        for (key, value) in pmap.items():
            if key != getattr(value, attribute):
                return (False,
                        "{} is not correct key for {}".format(key, value))
        return (True, "")
Ejemplo n.º 3
0
    def key_match_invariant(pmap):
        # Either the field allows None, in which case this is necessary,
        # or it doesn't in which case this won't do any harm since
        # invalidity of None will be enforced elsewhere:
        if pmap is None:
            return (True, "")

        for (key, value) in pmap.items():
            if key != getattr(value, attribute):
                return (
                    False, "{} is not correct key for {}".format(key, value)
                )
        return (True, "")
Ejemplo n.º 4
0
 def key_match_invariant(pmap):
     for (key, value) in pmap.items():
         if key != getattr(value, attribute):
             return (False,
                     "{} is not correct key for {}".format(key, value))
     return (True, "")