def validate(self):
        """Validate request data before sending it out. Return True/False."""
        # check if required_fields aren't present
        for field in set(self.required_fields) - set(self.request_data):
            if not isinstance(field, string_types):
                # field was a collection, iterate over it and check by OR
                return bool(set(field) & set(self.request_data))
            return False
        return True
def validate ( self ) : for field in set ( self . required_fields ) - set ( self . request_data ) : if not isinstance ( field , string_types ) : return bool ( set ( field ) & set ( self . request_data ) ) return False return True
Validate request data before sending it out. Return True/False.