def get(self): #file = open('myfile.txt') #lines = file.readlines() #s = "" #for line in lines: # s = s + line heads = self.request.headers authentication.createhashtable() authResult = authentication.checkAuth(heads['Response'], heads['Uname'], heads['Uri'],heads['Nonce'], heads['CNonce'], heads['Qop']) if (authResult == False): self.set_header("error", "error101") self.set_status(401) return else: path = self.request.uri print(path) process_path = path[1:] if process_path == '': process_path = '.' if (file_process.isDir(process_path)): dirlist = dbox_xml.list_file_dir(process_path) filename = dbox_xml.createXML(dirlist, "hrl.xml") con = dbox_xml.read_xml_file(filename) print(con) self.write(con) else: content = file_process.readFile(process_path) self.write(content)
def get(self): # file = open('myfile.txt') # lines = file.readlines() # s = "" # for line in lines: # s = s + line path = self.request.uri print(path) process_path = path[1:] if process_path == "": process_path = "." if file_process.isDir(process_path): dirlist = dbox_xml.list_file_dir(process_path) filename = dbox_xml.createXML(dirlist, "hrl.xml") con = dbox_xml.read_xml_file(filename) print(con) self.write(con) else: content = file_process.readFile(process_path) self.write(content)