[static-file] return Unauthorized on blocked directory listing
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 20 Mar 2012 18:29:13 +0100
changeset 8325 7f2337d7937f
parent 8324 75694a61f089
child 8326 2e793b2cdb57
[static-file] return Unauthorized on blocked directory listing This is more appropriate than 404 NOT FOUND
web/views/staticcontrollers.py
--- a/web/views/staticcontrollers.py	Tue Mar 20 18:28:24 2012 +0100
+++ b/web/views/staticcontrollers.py	Tue Mar 20 18:29:13 2012 +0100
@@ -31,6 +31,7 @@
 from datetime import datetime, timedelta
 from logging import getLogger
 
+from cubicweb import Unauthorized
 from cubicweb.web import NotFound
 from cubicweb.web.http_headers import generateDateTime
 from cubicweb.web.controller import Controller
@@ -58,7 +59,7 @@
         if osp.isdir(path):
             if self.directory_listing_allowed:
                 return u''
-            raise NotFound(path)
+            raise Unauthorized(path)
         if not osp.isfile(path):
             raise NotFound()
         if not debugmode: