def check_options(self,options): # similar to the Base class version, but additionally check/modify include path optlist,files = getopt.getopt(options.split(),self.legal_options,self.legal_longoptions) files = map(path_clt2svr,files) options = [] for o,a in optlist: if o=="-I": options.append(string.strip(o+" "+path_clt2svr(a))) else: options.append(string.strip(o+" "+a)) return string.join(options+files)
def check_options(self, options): # similar to the Base class version, but additionally check/modify include path optlist, files = getopt.getopt(options.split(), self.legal_options, self.legal_longoptions) files = map(path_clt2svr, files) options = [] for o, a in optlist: if o == "-I": options.append(string.strip(o + " " + path_clt2svr(a))) else: options.append(string.strip(o + " " + a)) return string.join(options + files)
def recv1(self): # new version of recv1: similar to the base version, but # with additional check/modification of path names. # Also check pathnames in include directives. try: [filename, filesize] = string.split(self.rfile.readline()) filesize = int(filesize) filename = path_clt2svr(filename) data = self.check_include(self.rfile.read(filesize), path_clt2svr) except ValueError: self.send_error("error while reading file info (" + filename + ")") except RuntimeError: self.send_error("bad filename in " + filename) except IOError: print "IOError" else: self.send_receipt() return (filename, data)
def recv1(self): # new version of recv1: similar to the base version, but # with additional check/modification of path names. # Also check pathnames in include directives. try: [filename,filesize] = string.split(self.rfile.readline()) filesize = int(filesize) filename = path_clt2svr(filename) data = self.check_include(self.rfile.read(filesize),path_clt2svr) except ValueError: self.send_error("error while reading file info ("+filename+")") except RuntimeError: self.send_error("bad filename in "+filename) except IOError: print "IOError" else: self.send_receipt() return (filename,data)