Project

General

Profile

« Previous | Next » 

Revision 1707

streams.py: CaptureStream: Ignore start_str when recording and end_str when not recording

View differences:

lib/streams.py
75 75
        self.matches = []
76 76
        
77 77
        def trace(str_):
78
            start_idx = str_.find(start_str)
79
            if start_idx >= 0:
80
                self.recording = True
81
                self.matches.append('')
82
            else: start_idx = 0
83
            
84
            recording = self.recording # save recording status
85
            
86
            end_idx = str_.find(end_str)
87
            if end_idx >= 0:
88
                self.recording = False
89
                end_idx += len(end_str)
90
            else: end_idx = len(str_)
91
            
92
            if recording: self.matches[-1] += str_[start_idx:end_idx]
78
            start_idx = 0
79
            if not self.recording:
80
                start_idx = str_.find(start_str)
81
                if start_idx >= 0:
82
                    self.recording = True
83
                    self.matches.append('')
84
            if self.recording:
85
                end_idx = str_.find(end_str)
86
                if end_idx >= 0:
87
                    self.recording = False
88
                    end_idx += len(end_str)
89
                else: end_idx = len(str_)
90
                
91
                self.matches[-1] += str_[start_idx:end_idx]
93 92
        
94 93
        TracedStream.__init__(self, trace, stream)

Also available in: Unified diff