(self,text)
| 42 | |
| 43 | #override write of stdout |
| 44 | def write(self,text): |
| 45 | proceed = 1 |
| 46 | lineNo = 0 |
| 47 | addText = '' |
| 48 | if self.func != None: |
| 49 | proceed,lineNo,newText = self.func(text) |
| 50 | if proceed: |
| 51 | if text.split() == []: |
| 52 | self.origOut.write(text) |
| 53 | else: |
| 54 | #if goint to stdout then only add line no file etc |
| 55 | #for stderr it is already there |
| 56 | if self.out: |
| 57 | if lineNo: |
| 58 | try: |
| 59 | raise "Dummy" |
| 60 | except: |
| 61 | newText = 'line('+str(sys.exc_info()[2].tb_frame.f_back.f_lineno)+'):'+newText |
| 62 | codeObject = sys.exc_info()[2].tb_frame.f_back.f_code |
| 63 | fileName = codeObject.co_filename |
| 64 | funcName = codeObject.co_name |
| 65 | self.origOut.write('file '+fileName+','+'func '+funcName+':') |
| 66 | self.origOut.write(newText) |
| 67 | |
| 68 | |
| 69 | #pass all other methods to __stdout__ so that we don't have to override them |
no test coverage detected