Пример #1
0
 def safe_string(self, data):
     '''
     Strips out quoted data (i.e., data taken directly from a file).
     '''
     quoted_string = get_quoted_strings(data)
     if quoted_string:
         data = data.replace('"' + quoted_string + '"', "")
     return data
Пример #2
0
 def safe_string(self, data):
     '''
     Strips out quoted data (i.e., data taken directly from a file).
     '''
     quoted_string = get_quoted_strings(data)
     if quoted_string:
         data = data.replace('"' + quoted_string + '"', "")
     return data
Пример #3
0
 def safe_string(self, data):
     """
     Strips out quoted data (i.e., data taken directly from a file).
     """
     quoted_string = get_quoted_strings(data)
     if quoted_string:
         data = data.replace(quoted_string, "")
     return data
Пример #4
0
    def is_valid(self, data):
        '''
        Validates that result data does not contain smart keywords in file-supplied strings.

        @data - Data string to validate.

        Returns True if data is OK.
        Returns False if data is not OK.
        '''
        # All strings printed from the target file should be placed in strings, else there is
        # no way to distinguish between intended keywords and unintended keywords. Get all the
        # quoted strings.
        quoted_data = get_quoted_strings(data)

        # Check to see if there was any quoted data, and if so, if it contained the keyword starting delimiter
        if quoted_data and Tag.TAG_DELIM_START in quoted_data:
            # If so, check to see if the quoted data contains any of our keywords.
            # If any keywords are found inside of quoted data, consider the keywords invalid.
            for tag in self.TAGS:
                if tag.tag in quoted_data:
                    return False
        return True
Пример #5
0
    def is_valid(self, data):
        '''
        Validates that result data does not contain smart keywords in file-supplied strings.

        @data - Data string to validate.

        Returns True if data is OK.
        Returns False if data is not OK.
        '''
        # All strings printed from the target file should be placed in strings, else there is
        # no way to distinguish between intended keywords and unintended keywords. Get all the
        # quoted strings.
        quoted_data = get_quoted_strings(data)

        # Check to see if there was any quoted data, and if so, if it contained the keyword starting delimiter
        if quoted_data and Tag.TAG_DELIM_START in quoted_data:
            # If so, check to see if the quoted data contains any of our keywords.
            # If any keywords are found inside of quoted data, consider the keywords invalid.
            for tag in self.TAGS:
                if tag.tag in quoted_data:
                    return False
        return True