1: #line 175 "sink_drivers.ipk"
2: import string
3: from interscript.drivers.sinks.base import sink_base
4: from interscript.drivers.sinks import sink_open_error
5:
6: class simple_named_file_sink(sink_base):
7: def __init__(self,pass_frame,input_filename, prefix='', eol='\n'):
8: self.eol = eol
9:
10:
11:
12:
13: pathlist = string.split(input_filename,'/')
14: self.basename = pathlist[-1]
15: platform = pass_frame.process.site.platform
16: pathname = platform.mk_dir(prefix, pathlist)
17: try:
18: file = platform.open(pathname,'w')
19: except:
20: raise sink_open_error,pathname
21: sink_base.__init__(self, name = input_filename, file = file)
22: if pass_frame: pass_frame.flist.append(pathname)
23:
24: def __del__(self):
25: self.file.close()
26:
27: def raw_write(self,line): self.file.write(line)
28: def raw_eol(self): self.raw_write(self.eol)
29: