Пример #1
0
 def handle(self):
   Handler.requestsProcessed += 1
   log.net("(#{}) File Requested: '{}'".format(Handler.requestsProcessed, self.fileName) + \
     (" for group {}".format(self.group) if self.group else ""))
     
   #Checking for user authorization
   self.userID = getCookie(self.cookies, self.COOKIE_ID)
   if not securityCanAccess(self.userID, self.group) and not self.fileName.endswith("password.html"):
     log.security("User not allowed to access", self.fileName+", returning password page")
     return self.redirectFile("password.html"+addParams({"redirect":self.fileName})) #Redirect back to the requested page when done
   
   try:
     return self.sendFile(self.fileName)
   except Exception as e: #Not BaseException though
     #In the event of any error, set this
     self.sendError(str(e))
     raise e #Raise it again so I can see what's going on