def load_objects(self): self.doing_first_lines = True self.first_object = True # First object will be treated differently last_line = False # A flag for last line (eof) detection lines = [] # A object line buffer, cleared after each object stored object_start_line = 0 # line number of object start while (True): next_line = self.get_line() # Detect last line before stripping away te \n if len(next_line) == 0: last_line = True G.debug('Detected last line.') next_line = next_line.strip('\n\r') G.debug(''.join(['Reading line: ', next_line])) # Check if it is an empty line, if so, finish object if not next_line: if len(lines): G.debug('Creating object.') # Create a Generic Object that can later be upgraded obj = Plugin.Generic(self.globalvars, lines, self.first_object, self.is_main_file, _filepath=self.filepath, _lineno=object_start_line) # Prepare for next round and save the current object lines = [] if not self.doing_first_lines: self.first_object = False if not obj.removed: self.objects.append(obj) else: G.debug('Skipping empty object.') object_start_line = self.lineno + 1 else: lines.append(next_line) #lines.append(next_line.strip()) if last_line: return