def execute(self, httpObject):
		filePath = self.rootDirectory + "/" + httpObject.getRequestPath()

		if not os.path.exists(filePath):
			httpObject.setField("Content-Type", "text/plain")
			return "File not found"

		params = httpObject.getParams().values()

		return str(subprocess.check_output(["python", filePath] + params))
    def execute(self, httpObject):
        filePath = self.rootDirectory + "/" + httpObject.getRequestPath()

        if not os.path.exists(filePath):
            httpObject.setField("Content-Type", "text/plain")
            return "File not found"

        params = httpObject.getParams().values()

        return str(subprocess.check_output(["python", filePath] + params))
	def execute(self, httpObject):
		filePath = self.rootDirectory + "/" + httpObject.getRequestPath()

		if not os.path.exists(filePath):
			httpObject.setField("Content-Type", "text/plain")
			return "File not found"

		fileContent = ""

		with open(filePath, "rb") as file:
			byte = file.read(1)
			while byte != "":
				fileContent += byte
				byte = file.read(1)
			
		httpObject.setField("Content-Type", self.getFileContentType(filePath))

		return fileContent
    def execute(self, httpObject):
        filePath = self.rootDirectory + "/" + httpObject.getRequestPath()

        if not os.path.exists(filePath):
            httpObject.setField("Content-Type", "text/plain")
            return "File not found"

        fileContent = ""

        with open(filePath, "rb") as file:
            byte = file.read(1)
            while byte != "":
                fileContent += byte
                byte = file.read(1)

        httpObject.setField("Content-Type", self.getFileContentType(filePath))

        return fileContent
        def canExecute(self, httpObject):
		return httpObject.getRequestPath() == "/upload/"
	def canExecute(self, httpObject):
		return httpObject.getRequestPath() in "/register/"
	def canExecute(self, httpObject):
		return re.match(".+\.py", httpObject.getRequestPath())
	def canExecute(self, httpObject):
		return not (httpObject.getRequestPath() in ("", "/"))
 def canExecute(self, httpObject):
     return httpObject.getRequestPath() == "/upload/"
Esempio n. 10
0
 def canExecute(self, httpObject):
     return httpObject.getRequestPath() in "/register/"
Esempio n. 11
0
 def canExecute(self, httpObject):
     return re.match(".+\.py", httpObject.getRequestPath())
Esempio n. 12
0
 def canExecute(self, httpObject):
     return not (httpObject.getRequestPath() in ("", "/"))